17 Commits
Author SHA1 Message Date
jetson d3d58ffcde fix: harden the output lifecycle (range requests, temp files, job gate)
Review of the compression branch (ce93c68..d7c1415): one Important and the
cheap real Minors, each with a RED test first.

- app.py: drop the manual Content-Length override - it broke ranged
  requests (206 announcing the full length while sending a slice).
  send_file sets it and the 206/Content-Range itself.
- app.py: the download route serves video extensions only, never the temp
  of an encode in flight.
- src/compress.py: the encode temp is unique per attempt (mkstemp), is
  validated (playable video) and fsynced before it replaces the original;
  a failing os.replace keeps the original and cleans the temp up instead
  of raising into the route. The compressed video keeps the source mode.
- src/compress.py: a stale temp of a killed encode is swept after 2 h
  instead of the 5-day video expiry.
- src/job.py: cancelled and failed jobs are not re-encoded; the job shows
  "Compressing..." while the encode runs.
- ERD.md: the $OUTPUT_DIR/*_compressed.mp4 row is gone.

328 tests pass (was 319).
2026-10-28 15:47:28 +07:00
jetson d7c1415975 docs: changelog, README and plan for the one-video-per-job output lifecycle
CHANGELOG: a finished job leaves one compressed video (compressed in place
under the plain name) and the job videos expire after 5 days.

README: the output lifecycle - one video per job, 5-day retention.

Plan: the implementation plan this branch followed.
2026-10-28 15:13:23 +07:00
jetson ce93c68dc2 docs: changelog and plan for the cross-model dedup fix
CHANGELOG: the same-class dedup dropped overlapping sacks (FCP keeps every
tracked detection) - published counts increase, the 20-minute test clip now
reports the same 161 in / 1 out as FCP.

Plan: Task 14 (dedup across models only) and the full-clip cross-check
result (161 / 1 / 160 on both sides).
2026-10-28 12:02:48 +07:00
jetson b2c0ce0011 docs: label the batch count as closed batches and record the FCP cross-check
The status page showed "Batches: 0" for a clip with an open batch, which
reads like "no batch was counted". The number is the count of FINISHED
batches, so say so.

Plan: record the FCP cross-check that was run on this box (a 60 s excerpt,
model mode C: FCP 6/0/6 vs the recounter 6/0/6 - the same counts) with the
exact commands.
2026-10-28 10:44:28 +07:00
jetson 82896969d6 docs: changelog and plan for the batch-lifecycle parity wave
Plan: add Task 12 (a broken zone calibration degrades instead of publishing
a wrong count) and Task 13 (FCP's batch lifecycle — count every frame, the
FSM's arguments, a real truck signal), update the file structure and the
verification steps, and record the two remaining gaps as out of scope (the
dynamic-mode counting line, the truncated flag in the UI).

CHANGELOG: the batch-lifecycle change (published counts and batch_count can
change for every clip), the zone-calibration hardening and the review-wave
fixes.
2026-10-28 10:04:59 +07:00
jetson 23ede68f28 docs: changelog for the FCP counting-parity branch and plan corrections
CHANGELOG: the thresholds, cadence, count-line window, batch lifecycle,
fail-fast config and truncation-flag changes, with their consequences for
the published counts. The Task 0 entry now says the annotated output is
1280x720 (an explicit output_height below 720 still downscales it).

Plan: add the Task 11 section (FCP's calibrated count-line x-window),
correct the Task 1 and Task 7 FCP citations, and refresh the file
structure and the verification snippet.
2026-10-28 09:23:19 +07:00
jetson d53e9426fb docs: changelog for the static-zone default (f4e7b5d) 2026-10-27 13:52:31 +07:00
jetson 167e20f26c docs: plan — pin analysis frame to 1280x720 and model input to 640x640 (FCP parity)
Task 0 added to the FCP parity plan: the decoded frame is resized to
1280x720 before inference (FCP predict.py:826), imgsz=640 is passed
explicitly on every track()/predict() call (FCP predict.py:467), and the
annotated output is written at exactly 1280x720.

Consequences pinned in the plan: the static zone and the counting polygon
are scaled in FCP's frame (build_static_roi(zone, 1280, 720)), and
min_bbox_area becomes literal FCP px^2 (config_loader.py:67) instead of
a scaled approximation.

Also fixed the Verification snippet: TruckROI has no line_x_start /
line_x_end fields, so it printed an AttributeError; expected output is
now '220 400 936'. Baseline test count refreshed 195 -> 204.
2026-10-27 12:33:21 +07:00
jetson dbaa87c4e8 docs: plan FCP counting-logic parity for feedmill_recounter
Audit of karung_counter_semarang (FCP) vs feedmill_recounter found the
counting core only partially synced: the unload-after-load gate, the
counting-polygon centroid filter, the calibrated static count line,
sack conf 0.30, box min_bbox_area 1000, stabilizer max_hold 10 and
real batch-FSM crossing events were never ported. Plan lists 10
TDD tasks, each pinned to the FCP file:line it mirrors. FCP itself
is read-only.
2026-10-26 12:07:52 +07:00
jetson 20f8b8f9e6 docs: update FCP handoff — direct .96→.93:9050 verified, tunnel reverted
Live E2E from .96: POST /api/analyze on 192.168.192.93:9050 -> 202 ->
job COMPLETED. Earlier 'firewall blocks everything' conclusion was
wrong: only ICMP ping is dropped; TCP works fine. Reverse tunnel was
built then reverted (e3a905e/cb483c0) per operator policy — doc now
records direct URL as the sanctioned path, with 401/409/400 handling
guidance and the real API key location.
2026-10-23 10:04:53 +07:00
jetson cb483c0824 Revert "feat: reverse SSH tunnel so FCP (.96) reaches recounter via 127.0.0.1:9050"
This reverts commit e3a905e170.
2026-10-20 15:49:15 +07:00
jetson e3a905e170 feat: reverse SSH tunnel so FCP (.96) reaches recounter via 127.0.0.1:9050
.96 cannot initiate connections to .93 (firewall drops NEW inbound,
100% ping loss .96->.93), but .93->.96 outbound works. start_tunnel.sh
opens ssh -R from .93 to .96, publishing recounter as .96's own
loopback :9050 - FCP sets RECOUNTER_URL=http://127.0.0.1:9050 and
counting stays on .93 hardware.

- start_tunnel.sh / stop_tunnel.sh (idempotent, keepalive, pidfile/log)
- start_dashboard.sh auto-starts tunnel (SKIP_TUNNEL=1 to opt out)
- stop_dashboard.sh stops tunnel alongside the web UI
- handoff doc section 1b: network solution + RECOUNTER_URL=127.0.0.1:9050
- E2E from .96: 401 no key / 202 with key / job COMPLETED on .93
2026-10-20 15:22:59 +07:00
jetson 371e9593d8 fix: review pass — atomic busy-guard, exact FCP mode filters, docs
- _ANALYZE_LOCK: busy-check through enqueue is atomic; overlapping
  POSTs can no longer both pass the busy guard (one-GPU contract)
- fcp.mode_models now {letter: {stem: engine_classes}} mirroring FCP
  models.modes engines[].classes exactly: B/D use v4-best truck-only
  role (not truck-detector), C filters yolo11n to box only — prevents
  sack double-count and truck-ROI divergence vs FCP batches
- CHANGELOG: document /api/analyze + stem filter fix
- handoff doc: correct precedence (fcp_mode wins over model_stems),
  correct B/D mapping note
- tests: 4 new (mode B/C/D filters, concurrent-submit race) — 195 pass
2026-10-20 11:34:34 +07:00
jetson ca0583b734 docs: AI handoff for FCP-side phase 2 (clip repush button) 2026-10-20 11:06:34 +07:00
jetson f779f05190 feat: add video reuse — re-analyze previous uploads without re-uploading 2026-09-21 09:35:29 +07:00
jetson 1bc5e0634c chore: remove duplicate v4-best (1).pt model file 2026-09-18 10:39:59 +07:00
jetson 927c84d605 init: project structure 2026-09-15 16:03:39 +07:00