Files
ai-training/_docs/02_document/modules/dto_imageLabel.md
T
Oleksandr Bezdieniezhnykh 142c6c4de8 Refactor constants management to use Pydantic BaseModel for configuration
- 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.
2026-03-27 18:18:30 +02:00

1.4 KiB
Raw Blame History

Module: dto/imageLabel

Purpose

Container class for an image with its YOLO-format bounding box labels, plus a visualization method for debugging annotations.

Public Interface

ImageLabel

Field/Method Type/Signature Description
image_path str Filesystem path to the image
image numpy.ndarray OpenCV image array
labels_path str Filesystem path to the labels file
labels list[list] List of YOLO bboxes: [x_center, y_center, width, height, class_id]
visualize (annotation_classes: dict) -> None Draws bounding boxes on image and displays via matplotlib

Internal Logic

  • visualize() converts BGR→RGB, iterates labels, converts normalized YOLO coordinates to pixel coordinates, draws colored rectangles using annotation_classes[class_num].color_tuple, displays with matplotlib.
  • Labels use YOLO format: center_x, center_y, width, height (all normalized 01), class_id as last element.

Dependencies

  • cv2 (external) — image manipulation
  • matplotlib.pyplot (external) — image display

Consumers

augmentation (as augmented image container), dataset-visualiser (for visualization)

Data Models

ImageLabel — image + labels container.

Configuration

None.

External Integrations

None.

Security

None.

Tests

Used by tests/imagelabel_visualize_test.py.