完成犯人带出检测,测试通过
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user