2.4 KiB
Edge RKNN Deploy
Production counter: direct LAN RTSP + YOLO RKNN + ByteTrack + SQLite batch store + Flask dashboard + FCP peer sync.
Quick install
# 1. Copy this folder to the RK3588 device
sudo mkdir -p /opt/feedmill
sudo cp -r feedmill/* /opt/feedmill/
sudo chown -R $(whoami):$(whoami) /opt/feedmill
# 2. Configure
cd /opt/feedmill
cp config.env.example .env
nano .env # SOURCE, MODEL_PATH, CAMERA_NAME, PEER_API_TOKEN, etc.
sed -i 's/\r$//' .env
# 3. Venv + services
chmod +x setup-venv.sh install-services.sh
sudo ./setup-venv.sh
sudo ./install-services.sh
Dashboard: http://<ip-device>:7000 (internal control: 127.0.0.1:5000).
Model checklist
Set .env to the exported .rknn model path and make sure class order matches:
NUM_CLASSES=3(sack, box, truck)COUNTED_CLASS_IDS=0,1(sack + box counted)TRUCK_CLASS_ID=2(truck defines counting zone only)COUNT_AXIS=yCROSS_DIRECTION=downMODEL_PATH=/opt/models/y11_11_20.rknn,IMGSZ=320
Direct camera RTSP
Set in .env:
SOURCE=rtsp://user:pass@192.168.x.x:554/stream1
Test before install:
ffplay -rtsp_transport tcp -t 5 "$SOURCE"
nc -zv <camera-ip> 554
Validation checklist
sudo systemctl is-active feedmill-counter feedmill-dashboard
PYTHONNOUSERSITE=1 /opt/feedmill/venv/bin/python -c "from rknnlite.api import RKNNLite; print('rknn ok')"
sudo journalctl -u feedmill-counter -n 20 --no-pager
Good signs:
Stream ready!RKNN model loaded: ...Frame 100 | Batch ...
Logs & restart
sudo journalctl -u feedmill-counter -f
sudo systemctl restart feedmill-counter # after .env change
Peer sync (FCP)
-
When the counter is in
BATCH_MODE=auto, peer-sync start/stop requests (forwarded withX-Peer-Sync: 1) are ignored and the current batch state is returned unchanged. -
In auto mode the batch timer (default 30s) is held while a truck is detected in the counting zone and counts down 30s after the truck leaves.
-
FCP POSTs start/stop to dashboard
/api/batch/startand/api/batch/stopwithX-API-Key: <PEER_API_TOKEN>. -
Body is forwarded to internal control server; metadata stored on batch row (
source,fcp_batch_number,plate,do_numbers,expected_sack,expected_box). -
Validate API key only when header present (dashboard UI unaffected).
-
See
docs/peer_sync_handoff.md.