diff --git a/rtsp_service_ws_Zoulang.py b/rtsp_service_ws_Zoulang.py index 345e9e7..5b666f3 100644 --- a/rtsp_service_ws_Zoulang.py +++ b/rtsp_service_ws_Zoulang.py @@ -13,6 +13,7 @@ import json import base64 import asyncio import websockets +import requests from dataclasses import dataclass from typing import Dict, Any, Tuple, List from datetime import datetime @@ -28,10 +29,10 @@ from yolox.tracker.byte_tracker import BYTETracker # Kadian 模型路径与ROI(可根据实际情况修改) detector_model_path = 'YOLO_Weight/prisoner_model.onnx' - +ALERT_PUSH_URL = "http://123.57.151.210:10000/picenter/websocket/test/process" # 输入尺寸 -input_size = 640 +input_size = 1280 # RTSP 服务配置 RTSP_TARGET_FPS = 10.0 @@ -687,6 +688,17 @@ class FrameProcessorWorker(threading.Thread): #if action_names and len(action_names) > 0: if push_actions and len(push_actions) > 0: self.ws_queue_2.put(msg, timeout=1.0) + # 发送POST请求 + post_msg = msg.copy() + post_msg['type'] = 2 + try: + response = requests.post(ALERT_PUSH_URL, json=post_msg, timeout=5.0) + if response.status_code == 200: + print(f"[INFO] POST alert sent successfully for actions: {push_actions}") + else: + print(f"[WARN] POST alert failed with status: {response.status_code}") + except Exception as e: + print(f"[ERROR] POST alert request failed: {e}") except queue.Full: print("[WARN] ws_send_queue full, drop frame message")