main
RKNN Sack Counter (Production)
RTSP + YOLO RKNN + ByteTrack line-crossing counter for sacks and boxes on Rockchip edge hardware.
Architecture
- Input: Direct LAN camera RTSP (low latency)
- Inference: YOLO
.rknnon RK3588 NPU - Logic: Line crossing (
sack+boxcounts) viabatch_store.py - Output:
feedmill.db+current_batch.json - Dashboard: Flask on port 7000
Batch lifecycle:
- Manual Mode (
BATCH_MODE=manual, default): Operator triggers Start Batch and Stop Batch manually via dashboard buttons or API. One 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 | 20:00 |
Commands
| Command | Purpose |
|---|---|
sudo systemctl status feedmill-counter |
Counter 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 |
COUNT_AXIS |
y for downward sack flow |
CROSS_DIRECTION |
down (default), up, ltr, rtl, or both |
LINE_Y / LINE_Y_FRAC |
Counting line position for downward flow |
Files
| File | Purpose |
|---|---|
counter_live_rknn.py |
RTSP + RKNN YOLO + ByteTrack line crossing |
batch_store.py |
SQLite persistence |
counter_dashboard.py |
Flask UI |
config.env.example |
Env template |
feedmill-counter.service |
Counter systemd unit |
install-services.sh |
Install + disable legacy MQTT counter |
The active production path is counter_live_rknn.py.
Languages
Python
62.2%
HTML
36.2%
Shell
1.6%