数据格式调整

This commit is contained in:
2026-02-13 17:13:57 +08:00
parent 45f9f1e812
commit 1b9f05c9a8

View File

@@ -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} 次发送")