How bharath5673/deepstream works
This repository is a DeepStream 8.0 video-analytics demo stack, not a single application. Its architecture splits cleanly into offline model preparation and runtime inference pipelines.
1. Primary purpose
The repo shows how to run NVIDIA DeepStream pipelines for:
- YOLO object detection
- YOLO pose estimation
- multi-object tracking
- ROI-based analytics/counting
- multi-model / multi-stream processing
- custom CNN deployment through ONNX conversion
2. Main runtime entry points
The top-level orchestration is centered around:
- QuickDemo.sh for a quick end-to-end launch
- test_ds.py for basic testing
- multiple Python DeepStream demos under DeepStream-Python/
These are the likely “start here” nodes in an architecture diagram.
3. Config-driven DeepStream layer
DeepStream-Configs/ contains the pipeline configuration boundary:
- config_infer_primary_yoloV8.txt
- config_infer_primary_yoloV8_pose.txt
- dstest2_tracker_config.txt
- labels.txt
This layer defines how DeepStream loads models, interprets outputs, and applies tracking. The design is strongly configuration-driven rather than hard-coded.
4. Python pipeline layer
DeepStream-Python/ contains several pipeline variants built around DeepStream’s Python bindings:
- deepstream_test_1.py — baseline sample
- deepstream_test_yolo_save_vid.py — detection + video output
- deepstream_test_yolo_track_save_vid.py — detection + tracking
- deepstream_test_yolo_track_ROI_save_vid.py — tracking + ROI analytics
- deepstream_test_yolo_track_multimodel.py — multi-model pipeline
- deepstream_test_yolo_track_pose_save_vid.py — pose pipeline with tracking/output
These scripts are the execution layer that ties together sources, inference, tracking, and sinks.
5. Input/output data flow
The repository uses local media files as inputs:
- inputs/4ktraffic.mp4
- inputs/people-detection.mp4
Output artifacts are written locally, such as:
- outputs/test.txt
- saved video files produced by the demo scripts
So the basic flow is: video file input → DeepStream pipeline → inference/tracking/analytics → file output.
6. Model artifacts
The weights/ directory contains deployed model artifacts in ONNX format:
- yolov8n.onnx
- yolov8n-pose.onnx
- yolo11n-pose.onnx
- yolov8n-face.onnx
These models are the inference boundary between offline training and runtime deployment. In the DeepStream setup, they are consumed through the config files and executed via NVIDIA’s inference stack.
7. Custom CNN conversion workflow
CNN-to-DeepStream/ is a separate offline preparation subsystem for adapting a custom classifier into the DeepStream runtime:
- convert_2_onnx.py handles model conversion
- gender/content/gender_model.h5 is the trained Keras model
- gender_model_training_log.json records training history
- custom_CNN_utkTest.ipynb and UTKFace_test.zip support experimentation/validation
This subsystem represents a distinct pipeline: training artifact → ONNX conversion → DeepStream-compatible deployment.
8. Tracking and ROI boundary
Tracking is not just a model feature here; it is a separate analytics stage configured through DeepStream tracker settings. ROI scripts suggest a pipeline shape of:
- detection
- object association/tracking
- region-of-interest logic
- event/count output
That makes tracking/ROI a post-inference analytics layer rather than part of the detector itself.
9. Multi-model / pose specialization
The repo includes specialized branches for:
- object detection
- pose estimation
- combined detection + pose
- multi-model inference in one pipeline
This implies the architecture supports multiple inference branches feeding a shared downstream tracker/renderer/sink path.
10. Deployment and environment assumptions
The stack is explicitly tuned for:
- DeepStream 8.0
- CUDA 12.x
- Python 3.10+
- Ubuntu 24.04
- Docker with NVIDIA Container Runtime, or bare-metal installation
These are important architectural constraints because DeepStream pipelines depend on GPU-accelerated inference and NVIDIA runtime support.
11. Repository boundary
The repo is best understood as three connected subsystems:
- runtime demos (DeepStream-Python/)
- pipeline configuration (DeepStream-Configs/)
- offline model prep/conversion (CNN-to-DeepStream/, weights/)
A diagram should show these as separate but connected layers, with models/configs flowing into the runtime pipelines.
12. Practical architecture summary
If you were drawing the system, the core path would be:
input media or stream → DeepStream pipeline script → inference config + ONNX model → tracker/ROI/pose logic → output video or text artifacts.
The main boundary is between model preparation and inference execution; the repo’s value is in providing ready-to-run templates across that boundary.
Main entry points: deepstream_test_yolo_track_ROI_save_vid.py ROI analytics · deepstream_test_yolo_track_multimodel.py Multi-model · deepstream_test_yolo_track_save_vid.py Track video · deepstream_test_yolo_track_pose_save_vid.py Pose video
Components 18
Runtime demos
Launch scripts and Python DeepStream pipeline variants.
- QuickDemo.sh · End-to-end demo entry point.
QuickDemo.sh - test_ds.py · Basic repository test entry point.
test_ds.py - Baseline · Minimal DeepStream Python sample.
DeepStream-Python/deepstream_test_1.py - Detect video · YOLO detection with video output.
DeepStream-Python/deepstream_test_yolo_save_vid.py - Track video · Detection plus tracking and video output.
DeepStream-Python/deepstream_test_yolo_track_save_vid.py - ROI analytics · Tracking pipeline with region-of-interest logic.
DeepStream-Python/deepstream_test_yolo_track_ROI_save_vid.py - Multi-model · Multi-model DeepStream pipeline.
DeepStream-Python/deepstream_test_yolo_track_multimodel.py - Pose video · Pose estimation pipeline with tracking and output.
DeepStream-Python/deepstream_test_yolo_track_pose_save_vid.py
Pipeline config
Inference, tracker, and label configuration consumed by runtime pipelines.
- YOLO config · Primary detector configuration.
DeepStream-Configs/config_infer_primary_yoloV8.txt - Pose config · Primary pose model configuration.
DeepStream-Configs/config_infer_primary_yoloV8_pose.txt - Tracker config · DeepStream tracker settings.
DeepStream-Configs/dstest2_tracker_config.txt - Labels · Label map for inference outputs.
DeepStream-Configs/labels.txt - YOLOv8 ONNX · Object detection deployment model.
weights/yolov8n.onnx - Pose ONNX · Pose estimation deployment model.
weights/yolov8n-pose.onnx - YOLO11 pose · Alternative pose deployment model.
weights/yolo11n-pose.onnx - Face ONNX · Face detection deployment model.
weights/yolov8n-face.onnx
Model prep
Offline conversion and training-artifact boundary for custom CNN deployment.
- ONNX convert · Converts a custom CNN for DeepStream deployment.
CNN-to-DeepStream/convert_2_onnx.py - Gender model · Trained Keras classifier used for conversion.
CNN-to-DeepStream/gender/content/gender_model.h5
Connections 22
- QuickDemo.sh → Detect video: launches · Primary quick-start path.
- QuickDemo.sh → Track video: launches · Quick demo can run tracking pipeline.
- QuickDemo.sh → Pose video: launches · Quick demo can run pose pipeline.
- test_ds.py → Baseline: exercises · Basic smoke-test pipeline.
- Detect video → YOLO config: loads · Uses detector config.
- Detect video → YOLOv8 ONNX: runs · Consumes YOLO model artifact.
- Track video → YOLO config: loads · Uses detector config.
- Track video → Tracker config: enables · Adds object tracking stage.
- Track video → YOLOv8 ONNX: runs · Consumes YOLO model artifact.
- ROI analytics → YOLO config: loads · Detection input to ROI pipeline.
- ROI analytics → Tracker config: enables · Tracking boundary before ROI logic.
- ROI analytics → YOLOv8 ONNX: runs · Consumes YOLO model artifact.
- ROI analytics → Labels: labels · Uses class names for counting/annotation.
- Multi-model → YOLO config: loads · One branch uses detector config.
- Multi-model → Pose config: loads · Another branch uses pose config.
- Multi-model → YOLOv8 ONNX: runs · Detection branch model.
- Multi-model → Pose ONNX: runs · Pose branch model.
- Pose video → Pose config: loads · Uses pose model config.
- Pose video → Tracker config: enables · Adds tracking after pose inference.
- Pose video → Pose ONNX: runs · Consumes pose ONNX model.
- Baseline → Labels: annotates · Baseline sample output labeling.
- ONNX convert → Gender model: converts · Offline preparation for deployment.