refactor: 统一耗材视觉算法并扩展语音确认至全量候选清单

- 以 ConsumableVisionAlgorithmService 替代 consumable_classifier 与 tear_action;
  可选手部检测权重,未配置时全帧分类;时间窗众数与 Excel 白名单配置。
- 语音待确认:ASR 先匹配 pending topk,再匹配本台 candidate_consumables;
  记账 item_id 与 vision 一致使用 name_to_code。
- 更新 config、Compose、.env.example、依赖(pandas/openpyxl)与测试。

Made-with: Cursor
This commit is contained in:
Kevin
2026-04-22 16:31:12 +08:00
parent 4c4550d58b
commit 132702aea9
18 changed files with 791 additions and 476 deletions

View File

@@ -3,17 +3,15 @@ from loguru import logger
from app.config import settings
from app.repositories.surgery_results import SurgeryResultRepository
from app.repositories.voice_audits import VoiceAuditRepository
from app.services.consumable_classifier import ConsumableClassifierService
from app.services.baidu_speech import BaiduSpeechService
from app.services.consumable_vision_algorithm import ConsumableVisionAlgorithmService
from app.services.minio_audio_storage import MinioAudioStorageService
from app.services.surgery_pipeline import SurgeryPipeline
from app.services.voice_resolution import VoiceConfirmationService
from app.services.tear_action import TearActionService
from app.services.video.hikvision_runtime import HikvisionRuntime
from app.services.video.session_manager import CameraSessionManager
consumable_classifier_service = ConsumableClassifierService()
tear_action_service = TearActionService()
consumable_vision_algorithm_service = ConsumableVisionAlgorithmService()
hikvision_runtime = HikvisionRuntime.try_load(settings.hikvision_lib_dir)
if settings.hikvision_sdk_enabled and hikvision_runtime is None:
@@ -29,8 +27,7 @@ minio_audio_storage_service = MinioAudioStorageService(settings)
camera_session_manager = CameraSessionManager(
settings=settings,
consumable_classifier=consumable_classifier_service,
tear_action=tear_action_service,
vision_algorithm=consumable_vision_algorithm_service,
hikvision_runtime=hikvision_runtime,
result_repository=surgery_result_repository,
)
@@ -49,12 +46,8 @@ surgery_pipeline = SurgeryPipeline(
)
def get_consumable_classifier_service() -> ConsumableClassifierService:
return consumable_classifier_service
def get_tear_action_service() -> TearActionService:
return tear_action_service
def get_consumable_vision_algorithm_service() -> ConsumableVisionAlgorithmService:
return consumable_vision_algorithm_service
def get_surgery_pipeline() -> SurgeryPipeline: