Mapper
app.infrastructure.detection.model.torch.mapperMapper for converting TorchVision model output to DetectionPayload.
See Also
DetectionResult— normalized detection record produced by the mapperTorchDetectionModel— runs the mapped model output
Layer: Infrastructure. Context: Implements concrete processing and I/O behind application-facing contracts.
TorchDetectionMapper
Maps raw TorchVision detection results to DetectionPayload format.
Layer: Infrastructure. Context: Implements concrete processing or I/O behind application-facing contracts.
map(raw_results: dict, labels: list[str], chosen_labels: list[str] | None = None) -> list[DetectionResult]
staticmethod
Map TorchVision raw inference output to DetectionResult list.
| PARAMETER | DESCRIPTION |
|---|---|
raw_results
|
Raw model output (dict with "boxes", "scores", "labels" keys).
TYPE:
|
labels
|
Label names extracted from model weights metadata.
TYPE:
|
chosen_labels
|
Optional filter to include only these labels.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[DetectionResult]
|
List of DetectionResult instances filtered by confidence and label. |