feat(counting): align max_step_dy (160) and unload_confirm (1) with FCP main
This commit is contained in:
1 parent
3cc0919fb1
commit
b9d4bd11b3
8 files changed
+23
-23
No files matched your search
@@ -21,7 +21,7 @@ Feedmill Recounter: AI video analysis for counting sacks/boxes in feedmill video
|
||||
- `src/counting.py`: `LineCrossCounter` — the FCP counting gates (single count, corridor, ID switch, unload confirm).
|
||||
- Zone editor: `GET /calibrate` (`templates/calibrate.html`, `static/calibrate.js`); writes go through `POST /api/zones/<preset>` and `POST /api/zones/<preset>/reset` (localhost only).
|
||||
- Zone writes go through `POST /api/zones/<preset>` (localhost-only, validated, atomic). Do not hand-edit `zones.json` while the web app runs — the editor merges over the stored preset.
|
||||
- The counting gates live in `config.yaml` under `counting:` and match FCP `main` (`capture_below_px=100`, `max_step_dy_px=120`, `max_gap_frames=15`, `unload_confirm_frames=3`).
|
||||
- The counting gates live in `config.yaml` under `counting:` and match FCP `main` (`capture_below_px=100`, `max_step_dy_px=160`, `max_gap_frames=15`, `unload_confirm_frames=1`).
|
||||
- `tools/calibrate_zone.py` and the `/calibrate` page produce the same geometry; keep their count-line derivation in sync (`x_start=min`, `x_end=max`, `y=round(mean(ys))`).
|
||||
- Config: `config.yaml` (tunables), `zones.json` (fixed zones, 1280x720 analysis space), `.env` (paths/secrets).
|
||||
|
||||
|
||||
+3
-3
@@ -92,9 +92,9 @@ version tags are cut in this repo — `main` is the release line).
|
||||
- **Align corridor filter and default palet zone with FCP main (`91d8b48`)**:
|
||||
the corridor filter in `src/counting.py` now keeps `_initial_zone` when a
|
||||
detection sits deep in the truck bed (matching FCP `main`), while
|
||||
`counting.max_step_dy_px` (120) and `counting.unload_confirm_frames` (3)
|
||||
remain aligned with FCP's runtime `CountingConfig`
|
||||
(`src/config_loader.py:104-107`). Recalibrated `presets.default.palet` in
|
||||
`counting.max_step_dy_px` (120→160) and `counting.unload_confirm_frames` (3→1)
|
||||
now match FCP `main`'s `CountingConfig` (`src/config_loader.py:104-107`).
|
||||
Recalibrated `presets.default.palet` in
|
||||
`zones.json` and `DEFAULT_ZONES` to `[[408, 1], [893, 1], [893, 178], [405, 178]]`
|
||||
(scaled from FCP's 1920×1080 `[[612, 1], [1340, 1], [1340, 267], [608, 267]]`).
|
||||
`fcp-2026-10-15` stays unchanged.
|
||||
|
||||
@@ -148,10 +148,10 @@ Edit `config.yaml` instead of the code for these values; restart the job / re-ru
|
||||
|
||||
- `capture_below_px` (100) — corridor below the line: a sack deep in the truck
|
||||
bed never counts.
|
||||
- `max_step_dy_px` (120) — a per-step vertical jump of this size is an ID
|
||||
- `max_step_dy_px` (160) — a per-step vertical jump of this size is an ID
|
||||
switch: the track's history resets.
|
||||
- `max_gap_frames` (15) — frames a track may vanish before its history resets.
|
||||
- `unload_confirm_frames` (3) — consecutive "above" frames needed to confirm
|
||||
- `unload_confirm_frames` (1) — consecutive "above" frames needed to confirm
|
||||
an unload.
|
||||
|
||||
A track counts at most once. The unload branch is unreachable by design
|
||||
|
||||
+2
-2
@@ -43,9 +43,9 @@ batch:
|
||||
# Counting gates (FCP main, src/config_loader.py:104-107).
|
||||
counting:
|
||||
capture_below_px: 100 # corridor below the line: deep truck bed, never counts
|
||||
max_step_dy_px: 120 # per-step vertical jump = ID switch -> reset track history
|
||||
max_step_dy_px: 160 # per-step vertical jump = ID switch -> reset track history
|
||||
max_gap_frames: 15 # frames a track may vanish before its history resets
|
||||
unload_confirm_frames: 3 # consecutive "above" frames needed to confirm an unload
|
||||
unload_confirm_frames: 1 # consecutive "above" frames needed to confirm an unload
|
||||
|
||||
pipeline:
|
||||
detect_interval: 1 # detection+tracking every N frames (1 = every frame, most accurate)
|
||||
|
||||
+2
-2
@@ -55,9 +55,9 @@ DEFAULTS: dict = {
|
||||
"counting": {
|
||||
# FCP main, src/config_loader.py:104-107.
|
||||
"capture_below_px": 100,
|
||||
"max_step_dy_px": 120,
|
||||
"max_step_dy_px": 160,
|
||||
"max_gap_frames": 15,
|
||||
"unload_confirm_frames": 3,
|
||||
"unload_confirm_frames": 1,
|
||||
},
|
||||
"pipeline": {
|
||||
"detect_interval": 1,
|
||||
|
||||
+4
-4
@@ -60,9 +60,9 @@ class LineCrossCounter:
|
||||
margin: int = 20,
|
||||
dedup_radius: float = 30.0,
|
||||
capture_below: float = 100.0,
|
||||
max_step_dy: float = 120.0,
|
||||
max_step_dy: float = 160.0,
|
||||
max_gap_frames: int = 15,
|
||||
unload_confirm_frames: int = 3,
|
||||
unload_confirm_frames: int = 1,
|
||||
) -> None:
|
||||
self._line_y = line_y
|
||||
self._line_x_start = line_x_start
|
||||
@@ -392,9 +392,9 @@ class MultiClassLineCounter:
|
||||
margin: int = 20,
|
||||
dedup_radius: float = 30.0,
|
||||
capture_below: float = 100.0,
|
||||
max_step_dy: float = 120.0,
|
||||
max_step_dy: float = 160.0,
|
||||
max_gap_frames: int = 15,
|
||||
unload_confirm_frames: int = 3,
|
||||
unload_confirm_frames: int = 1,
|
||||
) -> None:
|
||||
self._sack = LineCrossCounter(
|
||||
line_y=line_y,
|
||||
|
||||
@@ -79,9 +79,9 @@ def test_constructor_defaults_match_fcp_config():
|
||||
"""Defaults mirror FCP's runtime config values (config_loader.py CountingConfig)."""
|
||||
c = LineCrossCounter(line_y=220, line_x_start=0, line_x_end=1280)
|
||||
assert c._capture_below == 100.0
|
||||
assert c._max_step_dy == 120.0
|
||||
assert c._max_step_dy == 160.0
|
||||
assert c._max_gap_frames == 15
|
||||
assert c._unload_confirm_frames == 3
|
||||
assert c._unload_confirm_frames == 1
|
||||
|
||||
|
||||
def test_corridor_below_capture_below_never_counts():
|
||||
@@ -182,13 +182,13 @@ def test_update_line_keeps_existing_track_history():
|
||||
def test_multiclass_forwards_gates_and_update_line():
|
||||
"""Both class counters get the same gates and the same line geometry."""
|
||||
c = MultiClassLineCounter(line_y=220, line_x_start=0, line_x_end=1280,
|
||||
capture_below=100.0, max_step_dy=120.0,
|
||||
max_gap_frames=15, unload_confirm_frames=3)
|
||||
capture_below=100.0, max_step_dy=160.0,
|
||||
max_gap_frames=15, unload_confirm_frames=1)
|
||||
for counter in (c._sack, c._box):
|
||||
assert counter._capture_below == 100.0
|
||||
assert counter._max_step_dy == 120.0
|
||||
assert counter._max_step_dy == 160.0
|
||||
assert counter._max_gap_frames == 15
|
||||
assert counter._unload_confirm_frames == 3
|
||||
assert counter._unload_confirm_frames == 1
|
||||
c.update_line(500, 10, 1200)
|
||||
assert c._sack.line_y == 500 and c._box.line_y == 500
|
||||
assert c._sack.line_x_start == 10 and c._box.line_x_end == 1200
|
||||
@@ -202,9 +202,9 @@ def test_counting_config_section_matches_fcp_values():
|
||||
cfg = load_config()
|
||||
counting = cfg["counting"]
|
||||
assert counting["capture_below_px"] == 100
|
||||
assert counting["max_step_dy_px"] == 120
|
||||
assert counting["max_step_dy_px"] == 160
|
||||
assert counting["max_gap_frames"] == 15
|
||||
assert counting["unload_confirm_frames"] == 3
|
||||
assert counting["unload_confirm_frames"] == 1
|
||||
assert DEFAULTS["counting"] == counting
|
||||
|
||||
|
||||
|
||||
@@ -1397,7 +1397,7 @@ def _patch_real_counter(monkeypatch, pipe_mod):
|
||||
return counters
|
||||
|
||||
# A sack that crosses the count line (y=360 in the 1280x720 analysis frame).
|
||||
# The y1 jump stays inside the FCP gates: <= max_step_dy (120 px) per frame and
|
||||
# The y1 jump stays inside the FCP gates: <= max_step_dy (160 px) per frame and
|
||||
# below the corridor bound (line_y + capture_below = 460 px).
|
||||
SACK_ABOVE = Detection(
|
||||
bbox=(600.0, 280.0, 640.0, 320.0), confidence=0.9, class_id=0,
|
||||
|
||||
Reference in new issue
Block a user