From 1b9f05c9a80b36d4a4cf03b367c96a6913d890f8 Mon Sep 17 00:00:00 2001 From: coldenMac <1119472557@qq.com> Date: Fri, 13 Feb 2026 17:13:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=A0=BC=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reproject/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/reproject/main.py b/reproject/main.py index 39e9155..294308e 100644 --- a/reproject/main.py +++ b/reproject/main.py @@ -17,7 +17,7 @@ from HeartRateMonitor import HeartRateMonitor SERVER_HOST = "10.128.50.6" SERVER_PORT = 65432 API_URL = "http://10.128.50.6:5000/api/states" -CAMERA_ID = "23373333" +CAMERA_ID = 5 BASIC_FACE_DB = { "Zhihang": {"name": "Zhihang Deng", "age": 20, "image-path": "zhihang.png"}, @@ -125,7 +125,7 @@ def analysis_thread(): payload = { "seat_id": CAMERA_ID, - "timestamp": time.strftime("%Y-%m-%d %H:%M:%S"), + "timestamp": int(time.time()), "heart_rate": 0, "emo_v": 0, "emo_a": 0, @@ -135,14 +135,14 @@ def analysis_thread(): "ear": 0, "mar": 0, "label": "", - "eye_close_freq": 0.0, + "eye_close_freq": 0, "iris_ratio_x": 0, "iris_ratio_y": 0, } front_data = { "seat_id": CAMERA_ID, - "timestamp": time.strftime("%Y-%m-%d %H:%M:%S"), + "timestamp": int(time.time()), "label": "", "eye_close_freq": 0.0, "iris_ratio_x": 0, @@ -299,7 +299,6 @@ def video_stream_thread(): server.provide_frame(frame) data = front_data_queue.get(timeout=1) server.send_data(json.dumps(data)) - out1.write(frame) # out2.write(frame) except queue.Empty: @@ -405,9 +404,11 @@ def data_upload_thread(): print( f"[Data Upload {i+1}/{BURST_COUNT}] {id_info} | Time:{data['time']}" ) + # print(json.dumps(data, indent=2)) except Exception as e: print(f"[Data] Upload Error: {e}") + # print(json.dumps(data, indent=2)) except queue.Empty: print(f"[Data] 队列为空,跳过第 {i+1} 次发送")