3.5 KiB
3.5 KiB
AGENTS.md — karung (sack counter)
Repo: https://git.proit.id/andrew/karung-counting-feedmill-semarang (transferred from ervan/; old remote redirects, but git remote set-url origin to the new URL).
AI video analytics (Jetson) counting feed sacks loaded onto trucks. UI/log strings are
Indonesian (karung=sack, truk=truck); YOLO class names are English
(sack, box, truck, person). Details: README.md, docs/.
Which pipeline to touch
predict.py= production AND dev CLI (runs askarung-counter.servicewith zero args). Dev flags:--source VID --env .env --model X --output-dir D --output-json F --sack-conf C --truck-conf C --box-conf C(placeholder, unused) --batch-timeout S --max-frames N --no-dashboard --no-db. Zero flags = systemd behaviour. Combined sack+truck model +src/modules, shapely zones, SQLite, live-frame publish.src/= shared library (detection/tracking/counting/batch).python -m src.mainstill works but prints a deprecation pointer topredict.py.archive/= retired experiments (predict_new.py,rpo_iki/,simple_predict.py, check/merge/test scripts). Git history preserved viagit mv. Don't resurrect without asking.
Gotchas
- Two env-key dialects: production
.envusesRTSP_URL,DB_PATH,MODEL_PATH, … (predict.py,counter_dashboard.py);src/config.pyreads different keys (LOCAL_RTSP,MODEL_SACK_PATH,MODEL_TRUCK_PATH, …). Check which loader your entry point uses before adding config. - Counting filters by class name, not ID:
SackDetectorkeepsname == "sack"only (src/detection.py); tracker keeps("sack", "truck")(src/tracking.py). The newyolo11n-bbox-100ep-sack+box-*.pthas aboxclass that nothing consumes yet — adding box support means extending those allow-lists plus counter semantics. - Verified checkpoint classes:
truck-detector={truck},model_karung_truk/v4-best= {sack,truck},karung-dimuat-*-seg-200e={person,sack} (seg; persons drawn, never counted),best={sack}.predict.pyauto-picksMODEL_PATHenv, elsemodel_karung_truk.engine>.pt>v4-best.pt. - 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. - Tests:
python -m pytest tests/ -q(smoke tests forcounting,batch,config— pure-Python, no cv2/ultralytics needed). CI (.github/workflows/ci.yml) installs onlynumpy python-dotenv pytest+ runs pytest +compileall. Deps:requirements.txt(unpinned; never pip-install torch from PyPI on the Jetson — use the NVIDIA wheels already on device). For visual checks run on a video file (--source), not the live RTSP. - Don't commit binaries/state:
.gitignoreexcludes*.pt/*.onnx/*.engine,*.mp4/*.jpg/*.png,*.db,.env,batch_history_folder/. Large weights and videos already sit untracked in the working tree — leave them alone.
Deploy (Jetson 192.168.192.96, user jetson)
deploy_to_jetson.pysyncs onlypredict.py,counter_dashboard.py,templates/{operator,monitoring,base}.html,.env, then restarts services. Edits elsewhere (e.g.src/,zones.json) need manual sync.- Services:
karung-counter(predict.py),karung-counter-dashboard(counter_dashboard.py, ports 5000/5721). TensorRT export:export_model.py(export_v4.pyvariant) — run on the Jetson, then repoint the loader at.engine.