File size: 3,229 Bytes
c6abe34 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | # Independent Models Migration
**Date:** February 24, 2026
## Summary
The system has been updated to use independently trained YOLOv5 models for player and ball detection instead of the combined models.
## Changes Made
### 1. Config Files Updated
- **`back-end/configs/configs.py`**
- `PLAYER_DETECTOR_PATH`: Changed from `TEAM_MODEL_PATH` β `models/player_detector_v1.pt`
- `BALL_DETECTOR_PATH`: Changed from `TEAM_MODEL_PATH` β `models/ball_detector_v1.pt`
- **`back-end/app/config.py`**
- `player_detector_path`: Updated from `"models/nbl_v3_combined.pt"` β `"models/player_detector_v1.pt"`
- `ball_detector_path`: Updated from `"models/nbl_v3_combined.pt"` β `"models/ball_detector_v1.pt"`
- `team_model_path`: Now uses `"models/nbl_v4_combined.pt"` (for team analysis)
- `personal_model_path`: Still uses `"models/nbl_v2_combined.pt"` (for personal analysis)
- **`back-end/test_system.py`**
- Model loader updated to use new independent model paths
### 2. Model Files in Production
```
back-end/models/
βββ player_detector_v1.pt (165 MB) - trained Feb 24 16:23
βββ ball_detector_v1.pt (165 MB) - trained Feb 24 17:10
βββ court_keypoint_detector.pt (399 MB) - existing
βββ nbl_v3_combined.pt (165 MB) - kept for reference
βββ nbl_v4_combined.pt (5.3 MB) - for team analysis
```
### 3. Training Metrics
#### Player Detector (train5)
- Model: YOLOv5l6u
- Epochs: 100
- mAP50: 0.745
- mAP50-95: 0.381
- Per-class performance:
- player: 0.851 (mAP50)
- hoop: 0.836
- referee: 0.802
- basketball: 0.744
- shot-clock: 0.518
#### Ball Detector (train6)
- Model: YOLOv5l6u
- Epochs: 100
- mAP50: 0.731
- mAP50-95: 0.403
- Per-class performance:
- player: 0.865 (mAP50)
- hoop: 0.909
- referee: 0.780
- basketball: 0.646
- shot-clock: 0.454
### 4. System Components Affected
The following components now use independent models:
- `trackers/player_tracker.py` - loads `player_detector_v1.pt`
- `trackers/ball_tracker.py` - loads `ball_detector_v1.pt`
- All video analysis pipelines pass the correct model paths via config
### 5. Backward Compatibility
- Combined models are still available in `models/` for reference
- `team_analysis.py` still uses team-oriented combined models for compatibility
- `personal_analysis.py` still uses personal analysis combined models
## Benefits
1. **Specialized Training**: Each detector trained specifically for its object class
2. **Better Performance**: Dedicated models allow for task-specific optimization
3. **Modular Architecture**: Easier to update individual detectors without affecting others
4. **Production Ready**: Both models trained on identical NBL-6 dataset for consistency
## Rollback Instructions
If needed, to revert to combined models:
```python
# In back-end/configs/configs.py
PLAYER_DETECTOR_PATH = TEAM_MODEL_PATH # = 'models/nbl_v4_combined.pt'
BALL_DETECTOR_PATH = TEAM_MODEL_PATH # = 'models/nbl_v4_combined.pt'
```
## Verification
All imports verified working:
```python
from configs import PLAYER_DETECTOR_PATH, BALL_DETECTOR_PATH
# PLAYER_DETECTOR_PATH = 'models/player_detector_v1.pt' β
# BALL_DETECTOR_PATH = 'models/ball_detector_v1.pt' β
```
|