⚙️ Vision Configuration
The Vision system is highly configurable via Environment Variables. These can be set in the .env file of the firstbreath-vision repository or injected via Dokploy.
🧠 Batch Inference Service
Control the behavior of the YOLO model and GPU utilization.
| Variable | Default | Description |
|---|---|---|
MODEL_PATH | /app/model.pt | Path to the YOLOv11 model file. |
INFERENCE_DEVICE | 0 | GPU Device ID (e.g., 0 for first GPU). Use cpu for CPU mode. |
CONFIDENCE_THRESHOLD | 0.5 | Minimum confidence (0.0 - 1.0) to report a detection. |
BATCH_WAIT_MS | 50 | Max time (ms) to wait for filling a batch before inferring. Lower = Lower latency, Higher = Better Throughput. |
PROMETHEUS_PORT | 4002 | Port for exposing metrics. |
🎥 Camera Manager
Manage RTSP connections and stream processing.
| Variable | Default | Description |
|---|---|---|
PROCESS_FPS | 5 | Target FPS for processing frames. Lowering this reduces CPU/GPU load. |
REDIS_HOST | localhost | Redis hostname. |
DB_CAMERA_USER | root | MySQL User. |
DB_CAMERA_PASSWORD | - | MySQL Password. |
🚨 Redis Worker (Motion Analysis)
Tune the sensitivity of alerts and metrics.
| Variable | Default | Description |
|---|---|---|
STRESSED_ALERT_SECONDS | 30 | Duration (seconds) of continuous agitation required to trigger a "STRESSED" alert. |
BATCH_INTERVAL | 1.0 | Seconds to buffer metrics before bulk inserting into MySQL. |
⚡️ Tuning Guide
Optimizing for Latency
- Set
BATCH_WAIT_MS=10 - Result: Faster detection, but higher GPU overhead per frame.
Optimizing for Throughput (Many Cameras)
- Set
BATCH_WAIT_MS=100 - Set
PROCESS_FPS=2(Process fewer frames per second per camera) - Result: Can handle 20+ cameras on a single GPU.