This commit is contained in:
2025-09-02 23:06:36 +08:00
parent 2a59bdcffc
commit 062ee6c70d
4 changed files with 47 additions and 22 deletions

View File

@ -7,6 +7,11 @@ def setup_logger():
配置一个全局日志记录器,支持输出到控制台和文件。
"""
# 创建一个日志记录器
# 配置日志
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger = logging.getLogger("ViolationDetectorLogger")
logger.setLevel(logging.DEBUG) # 设置最低级别为DEBUG

View File

@ -99,7 +99,7 @@ class OCRViolationDetector:
"""初始化RapidOCR引擎"""
self.logger.info("正在初始化RapidOCR引擎...")
config_path = r"../ocr/config/1.yaml"
config_path = r"D:\Git\bin\video\ocr\config\1.yaml"
try:
# 检查配置文件是否存在
if not os.path.exists(config_path):
@ -157,4 +157,3 @@ class OCRViolationDetector:
# 返回检测结果(是否有违禁词、所有违禁词列表、对应置信度列表)
return len(all_prohibited) > 0, all_prohibited, all_confidences