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.
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-03-27 18:18:30 +02:00
parent b68c07b540
commit 142c6c4de8
106 changed files with 5706 additions and 654 deletions
+50
View File
@@ -0,0 +1,50 @@
# NMS Overlap Removal Tests
**Task**: AZ-162_test_nms
**Name**: NMS Overlap Removal Tests
**Description**: Implement 3 tests for non-maximum suppression — overlapping kept by confidence, non-overlapping preserved, chain overlap resolution
**Complexity**: 1 point
**Dependencies**: AZ-152_test_infrastructure
**Component**: Blackbox Tests
**Jira**: AZ-162
**Epic**: AZ-151
## Problem
The NMS module removes overlapping detections based on IoU threshold (0.3), keeping the higher-confidence detection. Tests verify all overlap scenarios.
## Outcome
- 3 passing pytest tests in `tests/test_nms.py`
## Scope
### Included
- BT-NMS-01: Overlapping detections — keep higher confidence (IoU > 0.3 → 1 kept)
- BT-NMS-02: Non-overlapping detections — keep both (IoU < 0.3 → 2 kept)
- BT-NMS-03: Chain overlap resolution (A↔B, B↔C → ≤ 2 kept)
### Excluded
- Integration with inference pipeline (separate task)
## Acceptance Criteria
**AC-1: Overlap removal**
Given 2 Detections at same position, confidence 0.9 and 0.5, IoU > 0.3
When remove_overlapping_detections() runs
Then 1 detection returned (confidence 0.9)
**AC-2: Non-overlapping preserved**
Given 2 Detections at distant positions, IoU < 0.3
When remove_overlapping_detections() runs
Then 2 detections returned
**AC-3: Chain overlap**
Given 3 Detections: A overlaps B, B overlaps C, A doesn't overlap C
When remove_overlapping_detections() runs
Then ≤ 2 detections; highest confidence per overlapping pair kept
## Constraints
- Detection objects constructed in-memory (no fixture files)
- IoU threshold is 0.3 (from constants or hardcoded in NMS)