The model was unable to detect multiple seats due to overly aggressive thresholds:
- High confidence threshold (0.15) - Chairs have lower confidence scores than people
- Low IOU threshold (0.25) - Was filtering out valid overlapping detections
- Strict SORT tracker - Required 2 hits before tracking, missing quick appearances
- High SORT IOU (0.2) - Was merging close seats into single tracks
Confidence Threshold: 0.15 → 0.1
- Lower threshold allows detection of chairs with lower confidence
- Captures more seat candidates
- Trade-off: Slight increase in false positives (acceptable for library use)
IOU Threshold: 0.25 → 0.4
- Higher IOU allows overlapping bounding boxes to coexist
- Critical for detecting multiple chairs in close proximity
- Prevents NMS from suppressing valid detections
Max Age: 5 → 3
- Faster cleanup of lost tracks
- More responsive to scene changes
Min Hits: 2 → 1
- Immediately starts tracking detected objects
- No warmup period needed
- Better for detecting all seats from first frame
IOU Threshold: 0.2 → 0.15
- Lower threshold prevents merging of close seats
- Each seat maintains separate track ID
- Better spatial separation
-
.env- MODEL_CONF_THRESHOLD=0.1
- MODEL_IOU_THRESHOLD=0.4
- SORT_MAX_AGE=3
- SORT_MIN_HITS=1
- SORT_IOU_THRESHOLD=0.15
-
docker-compose.yml- Updated default values for all thresholds
- Ensures consistency in containerized deployment
-
api/services/frame_processor.py- Updated default parameters in init
- Updated SORT tracker initialization
✅ More seats detected - Lower confidence catches chairs with partial occlusion ✅ Separate tracking - Each chair gets unique ID, no merging ✅ Faster response - Min hits = 1 means immediate tracking ✅ Better spacing - Lower SORT IOU prevents close seats from merging
# Restart the server to pick up .env changes
python -m uvicorn api.main:app --reload# Rebuild and restart containers
docker-compose down
docker-compose up --build -d- Test with multiple chairs in close proximity
- Verify each chair gets separate seat ID
- Check occupancy detection with people sitting
- Monitor for false positives and adjust if needed
If you need to adjust further:
Too many false positives?
- Increase MODEL_CONF_THRESHOLD (try 0.12)
Seats still merging?
- Decrease SORT_IOU_THRESHOLD (try 0.1)
Missing quick movements?
- Keep SORT_MIN_HITS=1
Tracks disappearing too fast?
- Increase SORT_MAX_AGE (try 5)
| Parameter | Benefit | Cost |
|---|---|---|
| Lower confidence | More detections | More false positives |
| Higher IOU | Less suppression | Possible duplicates |
| Min hits = 1 | Immediate tracking | Less stable tracking |
| Lower SORT IOU | Better separation | Possible track switches |
✅ Docker compose config validated ✅ Python syntax checked ✅ All parameters synchronized across files ✅ Ready for deployment