AICamera is a DeepStream-based camera analytics project for running YOLO detection on RTSP/video streams, tracking objects, checking configured restricted zones, and sending alerts through Kafka, Telegram, a dashboard API, and a small web monitor for camera/ROI management.
- RTSP or video-file input through NVIDIA DeepStream/GStreamer.
- YOLO11 inference using ONNX/TensorRT configuration.
- Multi-camera configuration with polygon-based restricted zones.
- Kafka event pipeline for detection messages.
- Telegram alert sender for snapshots and text alerts.
- Dashboard push worker for external alert APIs.
- Flask web monitor for snapshots and polygon/camera configuration.
apps/ DeepStream pipeline, alert workers, camera config
apps/config/ YOLO, tracker, label, and camera polygon config files
bindings/ DeepStream Python binding sources
model/ ONNX model files
web_monitor/ Flask web monitor and templates
kafka_2.13-4.1.1/ Local Kafka distribution used by run.sh
run.sh Helper script to start Kafka and the DeepStream app
.env.example Example runtime configuration without real secrets
- Jetson Orin Nano is recommended for DeepStream.
- NVIDIA GPU or Jetson device with compatible drivers.
- NVIDIA DeepStream SDK 7.1.
- Python 3.10.
- GStreamer Python bindings.
- Kafka 4.1.1, included locally or downloaded by
run.sh.
Install common Python packages:
pip3 install -r web_monitor/requirements.txt
pip3 install confluent-kafka opencv-python numpy requests python-dotenvOn Ubuntu/Jetson, install DeepStream/GStreamer dependencies if missing:
sudo apt update
sudo apt install python3-gi python3-dev python3-gst-1.0 -y
sudo apt install libgstrtspserver-1.0-0 gstreamer1.0-rtsp -yCreate a local .env file from the example:
cp .env.example .envFill in real values only in .env. Do not commit .env.
RTSP_URL=rtsp://user:password@192.168.1.10/
VIDEO_SOURCES=rtsp://user:password@192.168.1.10/
TELEGRAM_BOT_TOKEN=123456:replace_me
TELEGRAM_CHAT_ID=-1001234567890
KAFKA_TOPIC=deepstream-test
KAFKA_SERVER=localhost:9092
KAFKA_GROUP=tele_notifier_group
DASHBOARD_API_URL=https://api.example.com/push_alert
DEBUG_DS=0
PORT=8000apps/config/config.json stores camera metadata and polygons. Keep camera credentials out of committed config files; use placeholder RTSP values in Git and put real stream URLs in .env or a local ignored config.
From the repository root:
chmod +x run.sh
./run.shThe script:
- Loads
.envwhen present. - Starts or initializes local Kafka.
- Creates the configured Kafka topic if needed.
- Runs
apps/hls_yolo_11.pywith the configured RTSP URL.
You can also run the DeepStream pipeline directly:
cd apps
DEBUG_DS=0 python3 hls_yolo_11.py -i "$RTSP_URL"Telegram Kafka notifier:
cd apps
python3 kafka_send_message.pyDashboard notifier:
cd apps
python3 dash_board.pyBoth workers read Kafka settings from .env. Telegram also requires TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID.
cd web_monitor
python3 server.pyOpen:
http://localhost:8000
Set VIDEO_SOURCES in .env as a comma-separated list for multiple cameras:
VIDEO_SOURCES=rtsp://user:pass@cam-1/,rtsp://user:pass@cam-2/- The DeepStream primary inference config is
apps/config/config_infer_primary_yolo11.txt. - The labels file is
apps/config/labels.txt. - Tracker settings live in
apps/config/dstest2_tracker_config.txtandapps/config/config_tracker_NvDCF_perf.yml. - The ONNX files are stored in
model/. - TensorRT engine files are generated locally and should not be committed.
If GStreamer behaves unexpectedly, clear the local cache:
rm -rf "$HOME/.cache/gstreamer-1.0/"*This repo intentionally avoids committing real camera URLs, Telegram tokens, chat IDs, API keys, and local .env files. Use .env.example as documentation and keep real values in .env or your deployment secret manager.
If a real secret was committed before, rotate it in the provider dashboard because deleting it from the current files does not remove it from Git history.