完成犯人带出检测,测试通过
This commit is contained in:
@@ -151,7 +151,7 @@ class VideoFacePrisonBiz(BaseFaceBiz):
|
|||||||
if current_time > self.person_cooldown[person_id]:
|
if current_time > self.person_cooldown[person_id]:
|
||||||
del 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: 当前时间戳
|
current_time: 当前时间戳
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
是否通过
|
(是否通过, 通过的person_id)
|
||||||
"""
|
"""
|
||||||
# 检查是否在冷却期内
|
# 检查是否在冷却期内
|
||||||
if person_id in self.person_cooldown:
|
if person_id in self.person_cooldown:
|
||||||
if current_time <= self.person_cooldown[person_id]:
|
if current_time <= self.person_cooldown[person_id]:
|
||||||
# 还在冷却期内,忽略此人
|
# 还在冷却期内,忽略此人
|
||||||
return False
|
return False, None
|
||||||
else:
|
else:
|
||||||
# 冷却期结束,删除记录
|
# 冷却期结束,删除记录
|
||||||
del self.person_cooldown[person_id]
|
del self.person_cooldown[person_id]
|
||||||
@@ -183,9 +183,9 @@ class VideoFacePrisonBiz(BaseFaceBiz):
|
|||||||
self.person_cooldown[person_id] = current_time + self.cooldown_seconds
|
self.person_cooldown[person_id] = current_time + self.cooldown_seconds
|
||||||
# 清空该人员的匹配记录
|
# 清空该人员的匹配记录
|
||||||
del self.person_tracking[person_id]
|
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]:
|
def process_frame(self, frame: np.ndarray) -> Tuple[np.ndarray, List[Dict], float]:
|
||||||
"""
|
"""
|
||||||
@@ -214,8 +214,9 @@ class VideoFacePrisonBiz(BaseFaceBiz):
|
|||||||
|
|
||||||
# 新增:判断是否已经通过
|
# 新增:判断是否已经通过
|
||||||
has_passed = False
|
has_passed = False
|
||||||
|
passed_person_id = None
|
||||||
if is_match and best_name:
|
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:
|
if is_match and not has_passed:
|
||||||
@@ -229,6 +230,7 @@ class VideoFacePrisonBiz(BaseFaceBiz):
|
|||||||
'best_match': best_name,
|
'best_match': best_name,
|
||||||
'is_match': is_match,
|
'is_match': is_match,
|
||||||
'has_passed': has_passed, # 新增:是否已经通过
|
'has_passed': has_passed, # 新增:是否已经通过
|
||||||
|
'passed_person_id': passed_person_id, # 新增:通过的person_id
|
||||||
'det_score': float(face.det_score),
|
'det_score': float(face.det_score),
|
||||||
'quality_metrics': quality_metrics,
|
'quality_metrics': quality_metrics,
|
||||||
'is_acceptable': is_acceptable
|
'is_acceptable': is_acceptable
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
cameras:
|
cameras:
|
||||||
- id: 1
|
- id: 1
|
||||||
name: "Entrance"
|
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"
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ RTSP 服务模块 - 简洁版本,直接使用原始服务
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import threading
|
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:
|
class SimpleRTSPServer:
|
||||||
@@ -23,7 +24,7 @@ class SimpleRTSPServer:
|
|||||||
|
|
||||||
# 创建原始服务实例
|
# 创建原始服务实例
|
||||||
self.service = RTSPService(config_path="config.yaml")
|
self.service = RTSPService(config_path="config.yaml")
|
||||||
|
|
||||||
# 在新线程中启动服务
|
# 在新线程中启动服务
|
||||||
self.thread = threading.Thread(
|
self.thread = threading.Thread(
|
||||||
target=self.service.start,
|
target=self.service.start,
|
||||||
|
|||||||
1050
rtsp_service_ws_prison.py
Normal file
1050
rtsp_service_ws_prison.py
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user