mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 22:56:34 +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.
1.8 KiB
1.8 KiB
Module: dto/annotationClass
Purpose
Defines the AnnotationClass data model and WeatherMode enum used in the training pipeline. Reads annotation class definitions from classes.json.
Public Interface
WeatherMode (Enum)
| Member | Value | Description |
|---|---|---|
Norm |
0 | Normal weather |
Wint |
20 | Winter conditions |
Night |
40 | Night conditions |
AnnotationClass
| Field/Method | Type/Signature | Description |
|---|---|---|
id |
int | Class ID (weather_offset + base_id) |
name |
str | Class name (with weather suffix if non-Norm) |
color |
str | Hex color string (e.g. #ff0000) |
color_tuple |
property → tuple | RGB tuple parsed from hex color |
read_json() |
static → dict[int, AnnotationClass] | Reads classes.json, expands across weather modes, returns dict keyed by ID |
Internal Logic
read_json()locatesclasses.jsonrelative to the parent directory of thedto/package- For each of the 3 weather modes, creates an AnnotationClass per entry in
classes.jsonwith offset IDs (0, 20, 40) - This produces up to 80 classes total (17 base × 3 modes = 51, but the system reserves 80 slots)
color_tuplestrips the first 3 characters of the color string and parses hex pairs
Dependencies
json,enum,os.path(stdlib)
Consumers
train (for YAML generation), dataset-visualiser (for visualization colors)
Data Models
AnnotationClass — annotation class with ID, name, color. WeatherMode — enum for weather conditions.
Configuration
Reads classes.json from project root (relative path from dto/ parent).
External Integrations
None.
Security
None.
Tests
None directly; used transitively by tests/imagelabel_visualize_test.py.