From 9d1dc412e8bb8f365be802e17dcaf174def10e5c Mon Sep 17 00:00:00 2001 From: zqc <835569504@qq.com> Date: Sun, 21 Dec 2025 15:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=91=E7=99=BD=E5=90=8D=E5=8D=95=E6=94=B9?= =?UTF-8?q?=E4=B8=BA0=E3=80=811?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base_face_biz.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/base_face_biz.py b/src/base_face_biz.py index 3f25d32..1c81681 100644 --- a/src/base_face_biz.py +++ b/src/base_face_biz.py @@ -27,7 +27,7 @@ class BaseFaceBiz: self.app = face_analysis # 业务参数配置 - self.list_mode = "blacklist" # "blacklist" 或 "whitelist" + self.list_mode = "0" # 0 = blacklist, 1= whitelist self.clarity_threshold = 100.0 # 清晰度阈值,低于此值认为人脸模糊 self.min_face_size = 20 # 最小人脸像素尺寸 self.pitch_threshold = 90 # 俯仰角阈值 @@ -39,11 +39,11 @@ class BaseFaceBiz: def set_list_mode(self, mode: str): """设置名单模式""" - if mode.lower() in ["blacklist", "whitelist"]: + if mode.lower() in ["0", "1"]: self.list_mode = mode.lower() print(f"✅ 名单模式设置为: {self.list_mode}") else: - print("❌ 无效的名单模式,请使用 'blacklist' 或 'whitelist'") + print("❌ 无效的名单模式,请使用 '0' 或 '1'") def get_list_mode(self) -> str: """获取当前名单模式""" @@ -307,7 +307,7 @@ class BaseFaceBiz: best_name, similarity = self.find_best_match(face.embedding) # 根据名单模式判断是否匹配 - if self.list_mode == "blacklist": + if self.list_mode == "0": # 黑名单模式:在黑名单中即为匹配(需要关注) is_match = best_name is not None and similarity >= self.similarity_threshold else: # whitelist @@ -342,7 +342,7 @@ class BaseFaceBiz: color = (128, 128, 128) # 灰色 - 质量不可接受 else: # 选择颜色 - 根据名单模式 - if self.list_mode == "blacklist": + if self.list_mode == "0": # 黑名单模式:匹配(在黑名单中)显示红色,不匹配显示绿色 color = (0, 0, 255) if is_match else (0, 255, 0) # 红色-黑名单, 绿色-正常 else: # whitelist