fix(auto-batch): truck presence needs 50% polygon overlap, config-authoritative timers
ci / smoke (push) Canceled after 0s

Big docked truck bbox rests 1-2px past detection_polygon bottom edge, so
100%-containment made truck_in_area flicker False -> batch 15 split (6+276)
on 2026-09-29 while the truck never left. v4-best.engine detected it at
conf 0.92-0.97 in every replayed frame (no model miss, no retraining).

- truck gate: frac_inside >= 0.5 instead of contains(bbox)
- batch.truck_gone_tolerance_seconds (new, 30) authoritative; drop the
  hardcoded batch_mgr._truck_gone_tolerance = 30.0 override;
  batch.timeout_seconds documented as sack-idle pause only
- [TRUCK] truck_in_area transition debug log
This commit is contained in:
andrew committed 2026-09-30 09:40:15 +07:00
1 parent 12f921f81c
commit f621ae86fb
8 files changed
+74 -9

No files matched your search

+5
View File
@@ -56,6 +56,11 @@ Indonesian (`karung`=sack, `truk`=truck); YOLO class names are English
`src/config.py` defaults: `models/best.engine` (sack) / `models/truck-detector.engine`.
- Counting trigger is the bbox **top edge (y1)** vs a truck-anchored line band
(`src/counting.py`, `src/truck_roi.py`); truck detect runs every 15th frame only.
- Auto-mode batch timers (`config.yaml batch:`): `timeout_seconds` = sack-idle
pause (→ `WAITING_FOR_ACTIVITY`), `truck_gone_tolerance_seconds` = truck-gone
finalize (hardcoded 30 s override in `predict.py` removed). `truck_in_area`
accepts ≥50 % bbox overlap of `detection_polygon` (100 % containment flickered
False for big docked trucks → split batches); transitions log `[TRUCK] truck_in_area`.
- **Tests:** `python -m pytest tests/ -q` (smoke tests for `counting`, `batch`,
`config`, `do_batch` — pure-Python; Flask API tests skip if flask/openpyxl
missing). Deps: `requirements.txt` (unpinned; **never** pip-install torch from