66 Commits
Author SHA1 Message Date
andrew e88f99667b docs: fix documentation drift (deploy sync list, active_mode G, best task)
ci / smoke (push) Canceled after 0s
- deploy_to_jetson.py: sync history.html + analytics.html, interfaces.py + streaming.py; drop nonexistent clip_jobs.py
- AGENTS.md: active_mode default now G; deploy sync list updated
- docs/deployment.md: deploy sync list + engine files updated
- docs/models.md: best task bbox (not seg); modes A-G, active_mode default G
2026-11-23 11:34:31 +07:00
andrew ba04c57334 feat(models): add YOLO26n mode G (unified sack+box+truck) and set active_mode to G
ci / smoke (push) Canceled after 0s
2026-11-18 15:34:44 +07:00
andrew 6d67885382 config: switch active model mode to F (yolo8n unified) 2026-11-17 13:07:29 +07:00
andrew 91d8b48f98 fix(zones): recalibrate palet zone above truck
ci / smoke (push) Canceled after 0s
2026-11-16 12:08:43 +07:00
andrew 95a63e1c8e feat(zones): add debug zone toggles, cursor coords, hot-reload, and update line/truck zones 2026-11-16 11:20:43 +07:00
andrew 6bf2ceb340 Revert "feat(debug): per-type zone toggles via office port (debug_zones.json)"
This reverts commit f666a101cc.
2026-11-16 10:36:25 +07:00
andrew f666a101cc feat(debug): per-type zone toggles via office port (debug_zones.json)
ci / smoke (push) Canceled after 0s
2026-11-16 10:29:57 +07:00
andrew 45fedc072f feat(zones): load zones from zones.json (source of truth) + debug view 2026-11-16 10:17:36 +07:00
andrew a88f1a521d Revert "feat(pipeline): letterbox frames to 1280x720 instead of stretching (fix zoomed live view)"
This reverts commit 2b9cbdc02c.
2026-11-16 10:14:35 +07:00
andrew 2b9cbdc02c feat(pipeline): letterbox frames to 1280x720 instead of stretching (fix zoomed live view) 2026-11-16 10:04:35 +07:00
andrew 58b77419f5 docs(peer-sync): token now sent (gitignored docs/peer_sync_token.txt)
ci / smoke (push) Canceled after 0s
2026-11-13 15:00:27 +07:00
andrew 0dbd7b153c gitignore: peer_sync_token.txt (untrack) 2026-11-13 14:59:17 +07:00
andrew 4099e7b9f6 gitignore: peer_sync_token.txt 2026-11-13 14:57:38 +07:00
andrew 8dd2372bb3 docs(peer-sync): record mirror test topology, verified start/stop results, zenai defects 2026-11-13 14:43:56 +07:00
andrew b5e5f72d27 feat(dashboard): push manual batch start/stop to zenai_nano_fcp peer
ci / smoke (push) Canceled after 0s
- src/peer_sync.py: stdlib urllib client, 2 attempts 0.5s apart, fail-soft
- counter_dashboard.py: hooks in api_batch_start/api_batch_stop, peer_sync in JSON
- operator/monitoring templates: warn operator when the peer call fails
- .env: PEER_API_URL (empty = disabled) / PEER_API_TOKEN / PEER_API_TIMEOUT
- docs/peer_sync_handoff.md: contract for the zenai side (not implemented there yet)
2026-11-13 13:33:21 +07:00
andrew af65d971c4 feat(models): add YOLO8 mode F (unified sack+box+truck, imgsz 320)
- config.yaml: models.paths.yolo8_unified + models.modes.F (active_mode stays E)
- commit yolo8n .pt + .onnx (TensorRT .engine stays gitignored, rebuild via export_model.py)
- deploy_to_jetson.py ships the new engine
- docs/models.md + models/modelREADME.md mode matrix, predict.py --model-mode help
2026-11-13 13:33:12 +07:00
andrew 7beb820230 switch active mode back to E
ci / smoke (push) Canceled after 0s
2026-11-06 14:19:12 +07:00
andrew 2c5b72786f switch active mode to A (combined only) 2026-11-05 16:31:42 +07:00
andrew 999c455ae0 set sack detection conf to 0.35 2026-11-05 16:18:22 +07:00
andrew 8448dcbbea port corridor-redesign counting tweaks from /opt/karung 2026-11-05 16:01:07 +07:00
andrew b47680fb8b feat: add side detection zones for sacks exiting through truck sides
- Add sack_side_exit_left and sack_side_exit_right polygons to zones.json
- Side detection allows counting sacks exiting through truck sides
- All tests pass
2026-10-16 11:03:14 +07:00
andrew 6c359ae0fc Revert "feat: ghost re-ID in counter; dedup radius 30->20"
This reverts commit 694e5fb28c.
2026-10-15 16:25:43 +07:00
andrew 694e5fb28c feat: ghost re-ID in counter; dedup radius 30->20
ci / smoke (push) Canceled after 0s
- src/counting.py: ghost table matches new track IDs to recently-vanished
  tracks within reid_dist/reid_window; inherits above/below/loaded history
  so occlusion-split sacks still count when they reappear below the line
- config.yaml: duplicate_circle_radius 30->20; add reid_dist=400,
  reid_window_frames=200 knobs under counting
- src/config_loader.py: parse reid_dist/reid_window_frames
- predict.py: pass reid knobs into MultiClassLineCounter
- tests: 3 new re-ID tests + config expectations
2026-10-15 15:06:09 +07:00
andrew 8351778857 chore: remove accidental tracked files 2026-10-15 11:52:51 +07:00
andrew 25f61170d9 fix: unload only after load; sack conf 0.3; box min_bbox 1000
- src/counting.py: gate unloading on tracks previously counted as loading (_loaded_tracks set)
- config.yaml: sack conf 0.4->0.3 (reduce undercounting), box min_bbox_area 1500->1000
- tests/test_counting.py: update test for new unload logic
2026-10-15 11:42:02 +07:00
andrew 7f585a1af7 ui: move dedup radius text lower (y=40->80) 2026-10-15 11:00:09 +07:00
andrew af27a4420e fix: clip timeout 600s + progress bar; occlusion tracking fix
ci / smoke (push) Canceled after 0s
- src/clip.py: default timeout 180->600s, add progress_cb callback
- counter_dashboard.py: read MOTIONEYE_CLIP_TIMEOUT env, pass progress to clip_batch, expose stage/piece/total in /status & /pending
- templates/history.html: render progress bar [███░░] 60% in running button
- .env.example: add MOTIONEYE_CLIP_TIMEOUT=600
- src/stabilizer.py: max_hold_frames 10->25 (hold bbox ~1s during worker occlusion)
- cfg/tracker.yaml: track_buffer 60->90 (FastTrack keeps lost track ~3.6s for re-ID)
- tests/test_clip.py: update expected timeout to 600
2026-10-15 10:26:59 +07:00
andrew 1c5b460a48 config: inference_stride 2->1 for crossing-timing accuracy experiment
ci / smoke (push) Canceled after 0s
stride 2 ran inference+line-cross every 2nd frame (~6-7Hz); a fast sack
moves 50-100px between inference frames, coarsening y1 timing/dedup.
Expected cost: det+box on every frame, fps ~13 -> ~9-10. Revert the
one line if accuracy does not improve within ~24h.
2026-10-13 16:06:45 +07:00
andrew 6d852186a5 feat(batch): keep 0-count manual batches + force mode change w/ confirm
ci / smoke (push) Canceled after 0s
A: manual/do_manual stops always record (covered/container trucks load
nothing the camera sees) - /api/batch/stop and log_manual_batch_stop
drop the 0/0 discard gate; auto finalize_batch keeps it.
B: office mode switch on active batch -> confirm dialog retries POST
{force:true}; backend force skips the 409 (office gate unchanged).
Predict keeps counts across a mid-batch flip (manual start seeds
set_counts from state file instead of reset; auto start reuses an
existing active_batch_info instead of minting a duplicate number).

85 tests pass (stop-discard tests flipped to keep; force 409/200/403).
2026-10-12 08:59:43 +07:00
andrew fb5e33ce21 fix(stream): break viewers/503 deadlock; add stage-level PERF
ci / smoke (push) Canceled after 0s
P0: after a reboot /dev/shm is empty -> S2 skipped all encodes ->
/api/live-video 503'd before the generator could count the viewer ->
viewers.json stayed 0 forever. Live view ON showed nothing (both ports).

- predict: one unconditional write when the frame file is missing
- dashboard: count viewer before the 503 guard, _unwatch() on 503/finally

P1: split pre-draw into grab/det/truck/box/state in [PERF].

verified: frame files created after restart, office+operator 200,
viewers.json 1/0 during connect -> 0/0 after, 85 tests pass
2026-10-08 09:07:36 +07:00
andrew f8cc9c0264 perf(stream): skip display work nobody watches (S3/S1/S2)
ci / smoke (push) Canceled after 0s
S3 instrumentation showed draw+enc = 27-33ms of a 79-116ms frame loop
(~30%) even with zero viewers.

- dashboard: viewers.json counter (total/full) written under lock on
  connect/disconnect
- predict: PERF log every 100 frames (loop/pre-draw/draw/enc/fps/viewers)
- S2: no viewer -> skip dashboard.draw + overlays + both encodes
- S1: encode 720p only for ?full=1 clients, preview only for preview clients

measured: viewers=0 draw=0ms enc=0ms loop 79->51-88ms;
preview viewer enc=11ms (was 18-25ms for both encodes)
2026-10-07 16:06:13 +07:00
andrew bfba267502 feat(stream+report): 480p preview toggle + DB/Excel report integrity
ci / smoke (push) Canceled after 0s
stream (A):
- predict writes _480.jpg (854x480 q60) alongside full frame
- /api/live-video serves preview by default, ?full=1 for 720p, falls
  back to full until a preview exists
- monitoring.html: 480p/720p pills (default 480p, localStorage)

report (B1 - stop losing numbers):
- seed MultiClassLineCounter from current_batch.json on startup
  (mid-batch restart no longer zeros the count)
- finalize orphan auto batch at startup instead of dropping the row
- finalize_batch: single transaction, timeout=10, 3 retries, loud log
- atomic state-file write (tmp + os.replace)

report (B2 - make History/Excel agree):
- day-detail header computed from the same rows as the table
  (was daily_summaries -> header never matched rows)
- camera/object_label scope on all reads + exports
- one-time net backfill migration (1809 legacy rows, user_version=1)
- exports: Boxes/Net/Plate/DO/Model columns + TOTAL row, inclusive range
- DB busy now 503 instead of empty 200; CUTOFF_TIME env split removed
2026-10-07 15:27:40 +07:00
andrew b0ac8ede28 perf(stream): write live frame every frame + dedup MJPEG
ci / smoke (push) Canceled after 0s
- predict.py: drop frame_idx%2 gate on write_live_frame (video ran at
  pipeline/2, ~4.8 unique fps)
- counter_dashboard.py: yield only on file (mtime,size) change so idle
  frames aren't resent 20x/s (was 19.7 fps wire, 74/97 duplicates)

measured: unique fps 4.2 -> 6.9 (= pipeline), 2.99 -> 0.94 MB/s
2026-10-07 13:59:28 +07:00
andrew 14bf75c832 feat(ui): mobile state for operator + office ports
- base: labelled Menu drawer <=640px, 44px targets, 16px inputs
- monitoring: wrap video/batch headers, clamp count, pill tap targets
- operator: media query, stacked stop modal, mode-banner z-index under header
- history: pin Batch # column while swiping 10-col table, min-width:0
- analytics: media query, chart tick/legend font 12
2026-10-06 15:29:03 +07:00
andrew 5db5aa99a0 fix(dashboard): unindent /api/current-batch read block
The batch-read try lived inside the live_status except handler, so a
successful FPS read fell through and returned None -> HTTP 500 on both
ports. Counts froze and the stop button never appeared.
2026-10-06 15:29:03 +07:00
andrew 5e190daaf6 feat(ui): hide DO-manual, OCR engine, require-plat on office page
ci / smoke (push) Canceled after 0s
display:none only — element IDs, JS handlers and endpoints stay intact,
so re-enabling is dropping three inline styles. Default batch mode is
manual for the POC, so operators shouldn't see DO/OCR controls.
2026-10-05 16:47:41 +07:00
andrew 0eef08ded7 docs(ui): truck-parking reminder in manual start modal
Both the static modal HTML and the confirmStartBatch() manual-branch
override now say 'Pastikan truk terparkir sempurna di posisi pemuatan
sebelum memulai batch.' Guidance only — manual mode still counts on
static geometry with no truck-presence check.
2026-10-05 15:40:30 +07:00
andrew 4bacf90e25 rebrand: Karung.AI / Karung Counter -> Feedmill Counting Platform
ci / smoke (push) Canceled after 0s
Brand strings only:
- UI page titles (base/monitoring/history/analytics), header logo, footer
- predict.py argparse description, systemd unit Description fields
- README + AGENTS headings, CHANGELOG entry
- header CSS shrinks below 640px so the longer name fits phone screens

Operational names intentionally unchanged (data/history continuity):
OBJECT_LABEL, DB paths, service unit filenames, repo/remote, Indonesian
UI/log strings (karung/truk).
2026-10-05 10:10:06 +07:00
andrew 6c5b1c8b30 feat(manual-batch): canonical plate + manual mode as default
ci / smoke (push) Canceled after 0s
- canonical_plate (uppercase alnum, strips space/dot/hyphen) at all plate
  write sites; pretty_plate for render (history, XLSX, operator tile) so
  B 1234 XYZ and B1234XYZ are one plate everywhere
- group_dos_by_plate compares canonical plates -> no false mixed_plates
- warn-only (never blocking) plate format hint in operator + monitoring modals
- batch.default_mode: manual (auto merged truck loads when a sack sat in the
  counting ROI); operator banner explains plate -> start -> stop
- docs + AGENTS known-limitation note; 85 tests pass
2026-10-05 09:36:32 +07:00
andrew 7ad995d8d1 feat(manual-batch): require plate number at manual mode start
ci / smoke (push) Canceled after 0s
Legacy manual batch start locked until plate entered:
- POST /api/batch/start manual branch returns 400 missing_plate when
  plate empty (strip + uppercase, no format regex)
- operator + monitoring start modals gain required plate input,
  confirm button disabled until filled
- operator plate tile also shows for manual batches (was do_manual only)
- do_manual unchanged (plate from DOs)
2026-10-02 15:10:13 +07:00
andrew f621ae86fb 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
2026-09-30 09:40:15 +07:00
andrew 12f921f81c feat: async clip jobs, Siap-unduh state, cross-page ready toast
ci / smoke (push) Canceled after 0s
2026-09-29 09:28:51 +07:00
andrew 14f5ed4aac fix: clip pad ±3s + OSD-clock alignment at cut points (single-frame OCR)
ci / smoke (push) Canceled after 0s
2026-09-28 16:33:49 +07:00
andrew 110d557dbf feat: batch clip download from motionEye (trim+concat, history Klip button) 2026-09-28 15:39:33 +07:00
andrew d3357fccef fix: gross-based batch discard, direction-correct event logs, wire CSV logger
ci / smoke (push) Canceled after 0s
2026-09-28 12:08:37 +07:00
andrew 508bee736d chore: drop helper scripts/ move, trim docs/scripts.md refs 2026-09-25 16:30:47 +07:00
andrew fbba169507 feat: RapidOCR default OCR engine, office-only ocr_engine, drop operator toggle
ci / smoke (push) Canceled after 0s
2026-09-25 16:18:41 +07:00
andrew 080237ad3b chore: move loose helper scripts into scripts/, fix doc refs 2026-09-25 14:33:02 +07:00
andrew 4a6b121eaf docs: root ERD.md (SQLite ERD, Mermaid), merge docs/do-erd.md
ci / smoke (push) Canceled after 0s
2026-09-25 14:22:25 +07:00
andrew a12056a5ad feat: config-authoritative conf gates + cross-model IoU sack suppression
ci / smoke (push) Canceled after 0s
2026-09-25 14:06:04 +07:00
andrew 1e4dc4201c feat: operator Sacks/Boxes/DO tiles, drop Net from history
ci / smoke (push) Canceled after 0s
2026-09-25 08:52:29 +07:00
andrew 0efcfa45b8 feat: DO-gated manual batch mode (auto default, office-only switches)
ci / smoke (push) Canceled after 0s
2026-09-24 15:45:12 +07:00
andrew 735e0c7594 config: tune sack conf to 0.30 and update changelog
ci / smoke (push) Canceled after 0s
2026-09-18 16:36:44 +07:00
andrew 0a2f4ccb71 config: decrease batch timeout_seconds from 30 to 20
ci / smoke (push) Canceled after 0s
2026-09-18 14:53:15 +07:00
andrew 6d980b73ce docs: add archive/archivedREADME.md with categorization
ci / smoke (push) Canceled after 0s
Catalog all 25 archived files: reference implementations, calibration
utilities, one-time DB migration/fix scripts, model export/debug tools,
and the rpo_iki experiment variant (+ recovery instructions).
2026-09-17 12:59:59 +07:00
andrew 12b70a3431 refactor: consolidate counting config through src/config_loader
- config.yaml gains counting.max_reid_frames (200) + debounce_frames (8);
  CountingConfig + parsing + pinned-value test added
- predict.py load_zones() delegates to read_zone_polygons() (geometry only);
  legacy zones.json knob reads removed (config.yaml is canonical)
- run_prediction wires 5 more live knobs from cfg.counting.* (entry/exit
  overlap, tolerance_missing_frames, max_reid_frames, debounce_frames)
- delete deprecated src/config.py (v3 keys) + tests/test_config.py;
  src/main.py bridges onto unified config so the deprecated entrypoint
  keeps working
- 8 never-read globals (JARAK_ABSORBSI_GHOST, CAMERA_NOISE_DEADBAND, ...)
  left untouched — flagged for Phase 2 dead-code cleanup

Verified: pytest 21 passed; full pipeline runs on synthetic video
(engines load, 30 frames, clean finish).
2026-09-17 12:59:54 +07:00
andrew 0467e0ce68 docs: add CHANGELOG.md, sync all guides with config.yaml migration
ci / smoke (push) Canceled after 0s
- CHANGELOG.md (Keep-a-Changelog, dated entries from git history)
- README: production pipeline framing, config table, layout, flags, changelog link
- configuration.md: legacy env overrides, zones geometry-only, archive paths
- scripts.md: current flags, correct archive/ paths, tracked vs ignored weights
- deployment.md: config.yaml in sync list, model_mode location, /api/model-modes
- models.md + architecture.md: config.yaml pointers, deprecated src/config.py
2026-09-17 12:04:56 +07:00
andrew 2d9c66cbb6 feat: unified config.yaml with extensible model presets (A-D data-driven, E/F ready)
ci / smoke (push) Canceled after 0s
- config.yaml canonical for stream/models/counting/batch/output/camera
- models.modes hold engines+class filters only; conf/iou/min_bbox in detection_params
- predict.py derives tracker roles structurally (no per-mode branching)
- dashboard mode switch validates + persists atomically to config.yaml
- .env keeps secrets/deployment only; zones.json geometry; tracker.yaml hyperparams
- batch_mode.json keeps manual/auto batch mode; legacy model_mode ignored w/ warning
- src/detection+tracking gain iou param (default 0.7 = no behavior change)
2026-09-17 11:44:45 +07:00
andrew 630f4bc29e chore: set model_mode default to C
ci / smoke (push) Canceled after 0s
2026-09-15 14:03:38 +07:00
andrew 8673a3a734 docs: rename models/README.md to models/modelREADME.md to avoid confusion with root README 2026-09-14 11:44:18 +07:00
andrew 20afa8182f track models/*.pt + *.onnx (clone-ready); keep *.engine gitignored (rebuildable)
ci / smoke (push) Canceled after 0s
2026-09-11 16:13:36 +07:00
andrew 262f7d064e refactor: move weights to models/ + per-mode README; update paths, deploy, docs
ci / smoke (push) Canceled after 0s
2026-09-11 15:52:38 +07:00
andrew 6e4af50646 feat: multi-model modes (A/B/C/D, default B) + box counting + manual-mode banner
ci / smoke (push) Canceled after 0s
2026-09-11 14:40:57 +07:00
andrew 52d3127302 refactor: single predict.py entrypoint (production + CLI), archive experiments
ci / smoke (push) Canceled after 0s
2026-09-10 15:56:17 +07:00
andrew beb9c9fb6b docs: architecture/models/config/scripts guides + DB and batch helper scripts
ci / smoke (push) Canceled after 0s
2026-09-10 11:50:29 +07:00
andrew a568ebb182 docs: new repo URL (andrew/...), requirements.txt, pytest smoke tests + CI 2026-09-10 11:49:37 +07:00