andrew 2abafd37e6 Switch theme toggle to SVG sun/moon icons
- Use sun_light mode.svg / moon_dark mode.svg in toggle button
- Swap icon src on theme change
- Invert sun icon in dark mode for contrast (brightness(0) invert(1))
2026-11-26 11:48:14 +07:00

RKNN Sack Counter (Production)

RTSP + YOLO RKNN + ByteTrack line-crossing counter for sacks, boxes, and trucks (truck = zone only) on Rockchip edge hardware. Unified batches report separate Sack and Box totals.

Architecture

  • Input: Direct LAN camera RTSP (low latency)
  • Inference: YOLO .rknn on RK3588 NPU (3 classes: sack=0, box=1, truck=2)
  • Logic: Line crossing (sack + box counts) via batch_store.py; truck bbox defines horizontal counting zone
  • Output: feedmill.db + current_batch.json (+ optional CSV/video/live frame)
  • Dashboard: Flask on port 7000; internal control server on 127.0.0.1:5000

Batch lifecycle:

  • Manual Mode (BATCH_MODE=manual, default): Operator triggers Start Batch / Stop Batch via dashboard buttons or API. One unified batch counts sacks and boxes together while reporting separate Sack and Box totals. Objects passing while stopped are ignored.
  • Auto Mode (BATCH_MODE=auto): Auto-creates batch on first crossing, closes batch after idle timeout (BATCH_TIMEOUT_SECONDS=600).

Deploy

See DEPLOY.md.

Item Default
Install path /opt/feedmill
Venv /opt/feedmill/venv
DB /opt/feedmill/feedmill.db
Dashboard http://<device-ip>:7000
Cutoff 06:00

Commands

Command Purpose
sudo systemctl status feedmill-counter feedmill-dashboard Services running?
sudo journalctl -u feedmill-counter -f Live logs
sudo systemctl restart feedmill-counter After .env change
sudo ./uninstall-services.sh Remove services

Key env vars

Variable Purpose
SOURCE Direct camera RTSP URL
MODEL_PATH .rknn file path (/opt/models/y11_11_20.rknn)
NUM_CLASSES Model class count (3: sack, box, truck)
COUNTED_CLASS_IDS Counted class IDs (0,1)
TRUCK_CLASS_ID Truck class ID for zone (2)
IOU NMS IoU threshold (default 0.45)
CONF / SACK_CONF / BOX_CONF / TRUCK_CONF Per-class confidence thresholds
ZONE_MODE auto (follow truck) or manual/fixed
COUNT_AXIS y for downward flow
CROSS_DIRECTION down (default), up, ltr, rtl, or both
LINE_Y / LINE_Y_FRAC Counting line position
BATCH_MODE manual or auto
DAILY_CUTOFF_TIME / CUTOFF_TIME Daily cutoff (06:00)
PEER_API_TOKEN Shared secret for FCP peer sync (X-API-Key)

Files

File Purpose
counter_live_rknn.py RTSP + RKNN YOLO + ByteTrack line crossing
batch_store.py SQLite persistence, unified batches, schema migration
counter_control.py Internal HTTP control server (127.0.0.1:5000)
counter_dashboard.py Flask UI, reporting, XLSX export, peer sync
config.env.example Env template
feedmill-counter.service Counter systemd unit
feedmill-dashboard.service Dashboard systemd unit
install-services.sh / setup-venv.sh Install / venv setup
tests/ stdlib unittest suites
docs/peer_sync_handoff.md FCP peer-sync spec
API.md Dashboard API reference

The active production path is counter_live_rknn.py.

S
Description
Nanopi Feedmill Counting Platform (FCP).
Readme
10 MiB
0 Stars 1 Watchers 0 Forks
Languages
Python 66.8%
HTML 31.8%
Shell 1.4%