Skip to main content

⚙️ 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.

VariableDefaultDescription
MODEL_PATH/app/model.ptPath to the YOLOv11 model file.
INFERENCE_DEVICE0GPU Device ID (e.g., 0 for first GPU). Use cpu for CPU mode.
CONFIDENCE_THRESHOLD0.5Minimum confidence (0.0 - 1.0) to report a detection.
BATCH_WAIT_MS50Max time (ms) to wait for filling a batch before inferring. Lower = Lower latency, Higher = Better Throughput.
PROMETHEUS_PORT4002Port for exposing metrics.

🎥 Camera Manager

Manage RTSP connections and stream processing.

VariableDefaultDescription
PROCESS_FPS5Target FPS for processing frames. Lowering this reduces CPU/GPU load.
REDIS_HOSTlocalhostRedis hostname.
DB_CAMERA_USERrootMySQL User.
DB_CAMERA_PASSWORD-MySQL Password.

🚨 Redis Worker (Motion Analysis)

Tune the sensitivity of alerts and metrics.

VariableDefaultDescription
STRESSED_ALERT_SECONDS30Duration (seconds) of continuous agitation required to trigger a "STRESSED" alert.
BATCH_INTERVAL1.0Seconds 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.