# Module: inference/dto ## Purpose Data transfer objects for the inference subsystem: Detection, Annotation, and a local copy of AnnotationClass/WeatherMode. ## Public Interface ### Detection | Field | Type | Description | |-------|------|-------------| | `x` | float | Normalized center X | | `y` | float | Normalized center Y | | `w` | float | Normalized width | | `h` | float | Normalized height | | `cls` | int | Class ID | | `confidence` | float | Detection confidence score | | `overlaps(det2, iou_threshold) -> bool` | method | IoU-based overlap check | ### Annotation | Field | Type | Description | |-------|------|-------------| | `frame` | numpy.ndarray | Video frame image | | `time` | int/float | Timestamp in the video | | `detections` | list[Detection] | Detected objects in this frame | ### AnnotationClass (duplicate) Same as `dto/annotationClass.AnnotationClass` but with an additional `opencv_color` field (BGR tuple). Reads from `classes.json` relative to `inference/` parent directory. ### WeatherMode (duplicate) Same as `dto/annotationClass.WeatherMode`. ## Internal Logic - `Detection.overlaps()` computes IoU between two bounding boxes and returns True if above threshold. - `AnnotationClass` here adds `opencv_color` as a pre-computed BGR tuple from the hex color for efficient OpenCV rendering. ## Dependencies - `json`, `enum`, `os.path` (stdlib) ## Consumers inference/inference ## Data Models Detection, Annotation, AnnotationClass, WeatherMode. ## Configuration Reads `classes.json` from project root. ## External Integrations None. ## Security None. ## Tests None.