完成犯人带出检测,测试通过

This commit is contained in:
zqc
2026-01-08 22:49:08 +08:00
parent 1b8b24ab3e
commit 62a0e03ece
4 changed files with 1063 additions and 9 deletions

View File

@@ -151,7 +151,7 @@ class VideoFacePrisonBiz(BaseFaceBiz):
if current_time > self.person_cooldown[person_id]:
del self.person_cooldown[person_id]
def _is_person_passed(self, person_id: str, current_time: float) -> bool:
def _is_person_passed(self, person_id: str, current_time: float) -> Tuple[bool, Optional[str]]:
"""
判断人员是否已经通过
@@ -160,13 +160,13 @@ class VideoFacePrisonBiz(BaseFaceBiz):
current_time: 当前时间戳
返回:
是否通过
(是否通过, 通过的person_id)
"""
# 检查是否在冷却期内
if person_id in self.person_cooldown:
if current_time <= self.person_cooldown[person_id]:
# 还在冷却期内,忽略此人
return False
return False, None
else:
# 冷却期结束,删除记录
del self.person_cooldown[person_id]
@@ -183,9 +183,9 @@ class VideoFacePrisonBiz(BaseFaceBiz):
self.person_cooldown[person_id] = current_time + self.cooldown_seconds
# 清空该人员的匹配记录
del self.person_tracking[person_id]
return True
return True, person_id
return False
return False, None
def process_frame(self, frame: np.ndarray) -> Tuple[np.ndarray, List[Dict], float]:
"""
@@ -214,8 +214,9 @@ class VideoFacePrisonBiz(BaseFaceBiz):
# 新增:判断是否已经通过
has_passed = False
passed_person_id = None
if is_match and best_name:
has_passed = self._is_person_passed(best_name, current_time)
has_passed, passed_person_id = self._is_person_passed(best_name, current_time)
# 如果匹配但未通过,记录匹配时间
if is_match and not has_passed:
@@ -229,6 +230,7 @@ class VideoFacePrisonBiz(BaseFaceBiz):
'best_match': best_name,
'is_match': is_match,
'has_passed': has_passed, # 新增:是否已经通过
'passed_person_id': passed_person_id, # 新增通过的person_id
'det_score': float(face.det_score),
'quality_metrics': quality_metrics,
'is_acceptable': is_acceptable

View File

@@ -1,4 +1,5 @@
cameras:
- id: 1
name: "Entrance"
rtsp_url: "rtsp://8.130.165.33:8554/test"
# rtsp_url: "rtsp://8.130.165.33:8554/test"
rtsp_url: "rtsp://localhost:8554/test"

View File

@@ -3,7 +3,8 @@ RTSP 服务模块 - 简洁版本,直接使用原始服务
"""
import threading
from rtsp_service_ws_1217 import RTSPService
# from rtsp_service_ws_1217 import RTSPService
from rtsp_service_ws_prison import RTSPService
class SimpleRTSPServer:

1050
rtsp_service_ws_prison.py Normal file

File diff suppressed because it is too large Load Diff