# Component: Data Models ## Overview Shared data transfer objects for the training pipeline: annotation class definitions (with weather modes) and image+label containers for visualization and augmentation. **Pattern**: Plain data classes / value objects **Upstream**: None (leaf) **Downstream**: Data Pipeline (augmentation, dataset-visualiser), Training (YAML generation) ## Modules - `dto/annotationClass` — AnnotationClass, WeatherMode enum, classes.json reader - `dto/imageLabel` — ImageLabel container with bbox visualization ## Internal Interfaces ### WeatherMode (Enum) | Member | Value | Description | |--------|-------|-------------| | Norm | 0 | Normal weather | | Wint | 20 | Winter | | Night | 40 | Night | ### AnnotationClass ```python AnnotationClass(id: int, name: str, color: str) AnnotationClass.read_json() -> dict[int, AnnotationClass] # static AnnotationClass.color_tuple -> tuple # property, RGB ints ``` ### ImageLabel ```python ImageLabel(image_path: str, image: np.ndarray, labels_path: str, labels: list) ImageLabel.visualize(annotation_classes: dict) -> None ``` ## Data Access Patterns - `AnnotationClass.read_json()` reads `classes.json` from project root (relative to `dto/` parent) - `ImageLabel.visualize()` renders to matplotlib window (no disk I/O) ## Implementation Details - 17 base annotation classes × 3 weather modes = 51 classes with offset IDs (0–16, 20–36, 40–56) - System reserves 80 class slots (DEFAULT_CLASS_NUM in train.py) - YOLO label format: [x_center, y_center, width, height, class_id] — all normalized 0–1 - `color_tuple` parsing strips first 3 chars (assumes "#ff" prefix format) — fragile if color format changes ## Caveats - `AnnotationClass` duplicated in 3 locations (dto, inference/dto, annotation-queue/annotation_queue_dto) with slight differences - `color_tuple` property has a non-obvious parsing approach that may break on different color string formats - Empty files: `dto/annotation_bulk_message.py` and `dto/annotation_message.py` suggest planned but unimplemented DTOs ## Dependency Graph ```mermaid graph TD dto_annotationClass[dto/annotationClass] --> train dto_annotationClass --> dataset-visualiser dto_imageLabel[dto/imageLabel] --> augmentation dto_imageLabel --> dataset-visualiser ``` ## Logging Strategy None.