60 lines
1.8 KiB
Markdown
60 lines
1.8 KiB
Markdown
# Jetson Edge Counter (Production)
|
|
|
|
RTSP + YOLO TensorRT line-crossing counter for edge Jetson. Replaces MQTT `frigate-counter` on site.
|
|
|
|
## Architecture
|
|
|
|
- **Input:** Direct LAN camera RTSP (low latency)
|
|
- **Inference:** YOLO11n `.engine` (TensorRT) on Jetson GPU
|
|
- **Logic:** Line crossing (`ayam` count, `talenan` closes batch) via `batch_store.py`
|
|
- **Output:** `jetson_counter.db` + `current_batch.json`
|
|
- **Dashboard:** Flask on port **5000**
|
|
|
|
Batch lifecycle: talenan closes batch → idle until next ayam line cross (count starts at 1).
|
|
|
|
## Deploy
|
|
|
|
See **[DEPLOY.md](DEPLOY.md)**.
|
|
|
|
| Item | Default |
|
|
|------|---------|
|
|
| Install path | `/opt/jetson-counter` |
|
|
| Venv | `/opt/jetson-counter/venv` |
|
|
| DB | `/opt/jetson-counter/jetson_counter.db` |
|
|
| Dashboard | `http://<jetson-ip>:5000` |
|
|
| Cutoff | `20:00` |
|
|
|
|
## Commands
|
|
|
|
| Command | Purpose |
|
|
|---------|---------|
|
|
| `sudo systemctl status jetson-counter` | Counter running? |
|
|
| `sudo journalctl -u jetson-counter -f` | Live logs |
|
|
| `sudo systemctl restart jetson-counter` | After `.env` change |
|
|
| `sudo ./uninstall-services.sh` | Remove services |
|
|
|
|
## Key env vars
|
|
|
|
| Variable | Purpose |
|
|
|----------|---------|
|
|
| `SOURCE` | Direct camera RTSP URL |
|
|
| `MODEL_PATH` | `.engine` file path |
|
|
| `IMGSZ` / `HALF` | Must match engine export |
|
|
| `CROSS_DIRECTION` | `rtl` (default), `ltr`, or `both` |
|
|
| `LINE_X` / `LINE_X_FRAC` | Counting line position |
|
|
|
|
## Files
|
|
|
|
| File | Purpose |
|
|
|------|---------|
|
|
| `counter_live.py` | RTSP + YOLO + line crossing |
|
|
| `batch_store.py` | SQLite persistence |
|
|
| `counter_dashboard.py` | Flask UI |
|
|
| `config.env.example` | Env template |
|
|
| `jetson-counter.service` | Counter systemd unit |
|
|
| `install-services.sh` | Install + disable legacy MQTT counter |
|
|
|
|
## Dev stack
|
|
|
|
Lab / comparison: [`jetson-counter-dev/`](../jetson-counter-dev/) (port 8081, separate DB).
|