feat: Add video playback functionality and inference support

- Introduced VideoPlayer class to handle local video playback, emitting frames via frame_ready signal.
- Updated MainWindow to switch between camera and video sources, integrating video playback controls.
- Enhanced AppMenuBar with options to open video files and manage inference models.
- Implemented BboxOverlay for displaying detection results on video frames.
- Added InferenceManager to manage YOLO inference in a separate process, with error handling and restart logic.
- Created tests for BboxOverlay and InferenceManager to ensure functionality and robustness.
- Updated pyproject.toml to include optional dependencies for inference support.
This commit is contained in:
2026-05-13 21:30:13 +02:00
parent ac51498b7a
commit e9b474b1ed
14 changed files with 1524 additions and 49 deletions

View File

@@ -27,3 +27,20 @@ DISPATCHER_MAX_QUEUE_SIZE = 2 # max pending frames per slow subscriber before d
LOG_DIR = Path("logs") # relative to CWD (project root)
MAX_LOG_FILES = 20 # oldest sessions are deleted when exceeded
TELEMETRY_CSV_INTERVAL_S = 5.0 # how often a CSV row is written (seconds)
# Inference worker
INFERENCE_WORKER_TIMEOUT_S = 10.0 # seconds without response before watchdog fires
INFERENCE_MAX_RESTARTS = 3 # max auto-restart attempts before giving up
INFERENCE_POLL_INTERVAL_MS = 50 # how often GUI thread polls output queue (ms)
INFERENCE_WATCHDOG_INTERVAL_MS = 2000 # how often watchdog checks process health (ms)
# BBox overlay
BBOX_COLOR = (0, 220, 60, 255) # RGBA — vivid green
BBOX_LABEL_BG_COLOR = (0, 220, 60, 200) # RGBA — semi-transparent green for label bg
BBOX_LABEL_TEXT_COLOR = (0, 0, 0, 255) # RGBA — black text on green bg
BBOX_LINE_WIDTH = 2
BBOX_FONT_SIZE = 11
# Video file source
VIDEO_FILE_EXTENSIONS = "Video Files (*.mp4 *.avi *.mov *.mkv *.m4v *.webm)"
MODEL_FILE_EXTENSIONS = "YOLO Model (*.pt *.pth)"