Skip to content

Engine Interface

app.application.interfaces.detection.engine_interface

View source code

Interface contract for detection engine implementations.

See Also

Layer: Application. Context: Defines protocol boundaries consumed by application orchestration.

DetectionEngineInterface

Bases: Protocol

Abstraction boundary for YOLO / ML detection engine implementations.

Any object that exposes model_name, set_model(), and detect() with matching signatures satisfies this interface — no explicit inheritance required (structural subtyping via Protocol).

Layer: Application. Context: Coordinates use-case behavior through domain services and application contracts.

model_name: str property

Return the currently loaded model name.

RETURNS DESCRIPTION
str

Name of the model currently selected by the engine.

detect(frame: np.ndarray) -> list[DetectionResult]

Run inference on frame and return a list of DetectionResult objects.

PARAMETER DESCRIPTION
frame

RGB image array to pass to the detection model.

TYPE: ndarray

RETURNS DESCRIPTION
list[DetectionResult]

Detection results produced for the frame.

set_model(model_name: str) -> None

Switch to a different model by name.

PARAMETER DESCRIPTION
model_name

Registered model identifier accepted by the detection-model factory.

TYPE: str