2.2 KiB
2.2 KiB
ByteTrack Counter C++ — How to Run
Build
cd /opt/bytetrack-counter-cpp
mkdir -p build && cd build
cmake .. -DHAS_RKNN=ON
make -j$(nproc)
Run
Run from the project root (looks for .env in CWD by default):
cd /opt/bytetrack-counter-cpp
./build/bytetrack-counter
Specify a custom env file
Pass the path as the first argument:
./build/bytetrack-counter /path/to/custom.env
Or via environment variable:
ENV_FILE=/path/to/custom.env ./build/bytetrack-counter
Priority
- CLI argument (if provided)
ENV_FILEenvironment variable (if set)./.envin the working directory
Service (systemd)
sudo systemctl restart bytetrack-counter
journalctl -u bytetrack-counter -f
Environment Variables
See .env.example for a full reference. Key variables:
| Variable | Default | Description |
|---|---|---|
SOURCE |
rtsp://user:pass@192.168.0.100:554/stream1 |
RTSP camera URL |
MODEL_PATH |
/opt/models/yolo.rknn |
RKNN model file |
IMGSZ |
320 |
Model input size |
CONF |
0.3 |
Detection confidence threshold |
CORE_MASK |
1 |
RKNN NPU core mask (1, 2, 3, 7) |
CAMERA_NAME |
CC1 |
Camera ID label |
CROSS_DIRECTION |
rtl |
Line crossing direction: rtl, ltr, both |
LINE_X_FRAC |
0.5 |
Counting line position (fraction of frame width) |
TRACK_HIGH_THRESH_0 |
0.5 |
ByteTrack high threshold (ayam) |
TRACK_MATCH_THRESH_0 |
0.8 |
ByteTrack match threshold (ayam) |
TRACK_HIGH_THRESH_1 |
0.5 |
ByteTrack high threshold (talenan) |
TRACK_MATCH_THRESH_1 |
0.6 |
ByteTrack match threshold (talenan) |
AYAM_CLASS_ID |
0 |
YOLO class ID for ayam |
TALENAN_CLASS_ID |
1 |
YOLO class ID for talenan |
RATE_WINDOW_SEC |
60 |
Rate calculation sliding window (seconds) |
RECONNECT_DELAY_SEC |
3 |
Reconnect delay on stream drop / initial connect |
MAX_RECONNECT_ATTEMPTS |
0 |
Max reconnect attempts (0 = unlimited) |
LIVE_STREAM_ENABLED |
false |
Write JPEG snapshot for web dashboard |
RECORD_VIDEO |
false |
Record MP4 video segments |
OUTPUT_DIR |
/opt/bytetrack-counter-cpp |
Data output directory |
DB_PATH |
{OUTPUT_DIR}/bytetrack_counter.db |
SQLite database path |