数据格式调整
This commit is contained in:
@@ -17,7 +17,7 @@ from HeartRateMonitor import HeartRateMonitor
|
|||||||
SERVER_HOST = "10.128.50.6"
|
SERVER_HOST = "10.128.50.6"
|
||||||
SERVER_PORT = 65432
|
SERVER_PORT = 65432
|
||||||
API_URL = "http://10.128.50.6:5000/api/states"
|
API_URL = "http://10.128.50.6:5000/api/states"
|
||||||
CAMERA_ID = "23373333"
|
CAMERA_ID = 5
|
||||||
|
|
||||||
BASIC_FACE_DB = {
|
BASIC_FACE_DB = {
|
||||||
"Zhihang": {"name": "Zhihang Deng", "age": 20, "image-path": "zhihang.png"},
|
"Zhihang": {"name": "Zhihang Deng", "age": 20, "image-path": "zhihang.png"},
|
||||||
@@ -125,7 +125,7 @@ def analysis_thread():
|
|||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"seat_id": CAMERA_ID,
|
"seat_id": CAMERA_ID,
|
||||||
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S"),
|
"timestamp": int(time.time()),
|
||||||
"heart_rate": 0,
|
"heart_rate": 0,
|
||||||
"emo_v": 0,
|
"emo_v": 0,
|
||||||
"emo_a": 0,
|
"emo_a": 0,
|
||||||
@@ -135,14 +135,14 @@ def analysis_thread():
|
|||||||
"ear": 0,
|
"ear": 0,
|
||||||
"mar": 0,
|
"mar": 0,
|
||||||
"label": "",
|
"label": "",
|
||||||
"eye_close_freq": 0.0,
|
"eye_close_freq": 0,
|
||||||
"iris_ratio_x": 0,
|
"iris_ratio_x": 0,
|
||||||
"iris_ratio_y": 0,
|
"iris_ratio_y": 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
front_data = {
|
front_data = {
|
||||||
"seat_id": CAMERA_ID,
|
"seat_id": CAMERA_ID,
|
||||||
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S"),
|
"timestamp": int(time.time()),
|
||||||
"label": "",
|
"label": "",
|
||||||
"eye_close_freq": 0.0,
|
"eye_close_freq": 0.0,
|
||||||
"iris_ratio_x": 0,
|
"iris_ratio_x": 0,
|
||||||
@@ -299,7 +299,6 @@ def video_stream_thread():
|
|||||||
server.provide_frame(frame)
|
server.provide_frame(frame)
|
||||||
data = front_data_queue.get(timeout=1)
|
data = front_data_queue.get(timeout=1)
|
||||||
server.send_data(json.dumps(data))
|
server.send_data(json.dumps(data))
|
||||||
|
|
||||||
out1.write(frame)
|
out1.write(frame)
|
||||||
# out2.write(frame)
|
# out2.write(frame)
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
@@ -405,9 +404,11 @@ def data_upload_thread():
|
|||||||
print(
|
print(
|
||||||
f"[Data Upload {i+1}/{BURST_COUNT}] {id_info} | Time:{data['time']}"
|
f"[Data Upload {i+1}/{BURST_COUNT}] {id_info} | Time:{data['time']}"
|
||||||
)
|
)
|
||||||
|
# print(json.dumps(data, indent=2))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[Data] Upload Error: {e}")
|
print(f"[Data] Upload Error: {e}")
|
||||||
|
# print(json.dumps(data, indent=2))
|
||||||
|
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
print(f"[Data] 队列为空,跳过第 {i+1} 次发送")
|
print(f"[Data] 队列为空,跳过第 {i+1} 次发送")
|
||||||
|
|||||||
Reference in New Issue
Block a user