Worker Interface
app.application.interfaces.detection.worker_interfaceInterface contract for background detection worker implementations.
See Also
DetectionWorkerAdapter— adapts worker operations to this contractDetectionWorker— performs detection in the background
Layer: Application. Context: Defines protocol boundaries consumed by application orchestration.
DetectionWorkerInterface
Bases: Protocol
Abstraction boundary for background YOLO/ML detection worker threads.
Implementations must be startable, stoppable, and expose cached detection
results per frame index. Signals (batch_ready, progress_updated,
etc.) remain on the concrete class and are connected by the orchestrating
service; they are intentionally outside this minimal interface.
Layer: Application. Context: Coordinates use-case behavior through domain services and application contracts.
batch_ready = SignalInstance
class-attribute
instance-attribute
error_occurred = SignalInstance
class-attribute
instance-attribute
finished_processing = SignalInstance
class-attribute
instance-attribute
progress_updated = SignalInstance
class-attribute
instance-attribute
get_all_detections() -> dict[int, list[DetectionResult]]
Return a copy of all cached detections keyed by frame index.
| RETURNS | DESCRIPTION |
|---|---|
dict[int, list[DetectionResult]]
|
New dictionary mapping processed frame indices to detection results. |
get_detections(frame_index: int) -> list[DetectionResult] | None
Return cached detections for frame_index, or None if not yet processed.
| PARAMETER | DESCRIPTION |
|---|---|
frame_index
|
Zero-based index of the frame to query.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[DetectionResult] | None
|
Detections cached for the frame, or |
isRunning() -> bool
Return True while the worker thread is processing frames.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|
is_complete() -> bool
Return True after the full frame stream has been processed.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|
start() -> None
Start the detection thread.
stop() -> None
Request the detection thread to stop.