mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 22:16:35 +00:00
142c6c4de8
- Replaced module-level path variables in constants.py with a structured Pydantic Config class. - Updated all relevant modules (train.py, augmentation.py, exports.py, dataset-visualiser.py, manual_run.py) to access paths through the new config structure. - Fixed bugs related to image processing and model saving. - Enhanced test infrastructure to accommodate the new configuration approach. This refactor improves code maintainability and clarity by centralizing configuration management.
56 lines
1.6 KiB
Markdown
56 lines
1.6 KiB
Markdown
# 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.
|