mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-23 02:26:36 +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.
2.3 KiB
2.3 KiB
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 readerdto/imageLabel— ImageLabel container with bbox visualization
Internal Interfaces
WeatherMode (Enum)
| Member | Value | Description |
|---|---|---|
| Norm | 0 | Normal weather |
| Wint | 20 | Winter |
| Night | 40 | Night |
AnnotationClass
AnnotationClass(id: int, name: str, color: str)
AnnotationClass.read_json() -> dict[int, AnnotationClass] # static
AnnotationClass.color_tuple -> tuple # property, RGB ints
ImageLabel
ImageLabel(image_path: str, image: np.ndarray, labels_path: str, labels: list)
ImageLabel.visualize(annotation_classes: dict) -> None
Data Access Patterns
AnnotationClass.read_json()readsclasses.jsonfrom project root (relative todto/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_tupleparsing strips first 3 chars (assumes "#ff" prefix format) — fragile if color format changes
Caveats
AnnotationClassduplicated in 3 locations (dto, inference/dto, annotation-queue/annotation_queue_dto) with slight differencescolor_tupleproperty has a non-obvious parsing approach that may break on different color string formats- Empty files:
dto/annotation_bulk_message.pyanddto/annotation_message.pysuggest planned but unimplemented DTOs
Dependency Graph
graph TD
dto_annotationClass[dto/annotationClass] --> train
dto_annotationClass --> dataset-visualiser
dto_imageLabel[dto/imageLabel] --> augmentation
dto_imageLabel --> dataset-visualiser
Logging Strategy
None.