Skip to content

About

Production-shaped edge computer vision stack: YOLOv11 inference on NVIDIA DeepStream with MQTT/Mosquitto messaging, fully containerized for industrial edge deployment.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Containerized YOLOv11 with DeepStream and Mosquitto

This project provides a complete, containerized solution for running real-time object detection using YOLOv11 with NVIDIA DeepStream 7.1. All components are orchestrated using Docker Compose.

The pipeline is designed to take multiple video streams as input, perform inference using a YOLOv11 model, and then publish the resulting metadata to a MQTT Mosquitto broker. For visual verification, it also generates a tiled video output of the processed streams.

Key Features

  • Containerized: The entire environment, including DeepStream, dependencies, and the MQTT broker, is managed by Docker and Docker Compose for easy setup and portability.
  • YOLOv11 Integration: Uses a custom-built parser to integrate the powerful YOLOv11 model into the DeepStream pipeline. The model is converted to an ONNX format and then to a TensorRT engine for maximum performance.
  • MQTT Data Sink: Publishes rich inference metadata (object class, bounding boxes, sensor info) to a Mosquitto MQTT broker, perfect for IoT applications and further event-driven processing.
  • Multi-Stream Support: Configured to process four video streams in parallel.
  • File Output: Generates a tiled .mp4 video file of the output, complete with bounding box overlays for visual debugging and verification.

Project Structure

.
├── Dockerfile
├── docker-compose.yml
├── README.md
└── configs/
    ├── main.txt
    ├── yolo11.txt
    ├── msgconv.txt
    └── mosquitto.conf

Prerequisites

Before you begin, ensure you have the following installed on your system (tested on AWS EC2 g4dn.xlarge):

  • NVIDIA Driver: A compatible NVIDIA driver for your GPU.
  • NVIDIA Container Toolkit: To enable GPU support within Docker containers.
  • Docker: The latest version of Docker.
  • Docker Compose: The latest version of Docker Compose.

Setup and Installation

  1. Clone the Repository

    git clone https://github.com/feli-santos/containerized-deepstream-yolo-mosquitto.git
    cd containerized-deepstream-yolo-mosquitto
  2. Review Configurations (Optional)

    • configs/main.txt: The main DeepStream application config. Here you can change video source paths, enable/disable sinks, and adjust pipeline properties.
    • configs/yolo11.txt: The configuration for the YOLOv11 model, including the path to the ONNX model file and custom library.
    • configs/msgconv.txt: Defines the metadata for each camera/sensor that will be published to MQTT.
    • docker-compose.yml: Defines the services, volumes, and networks.
  3. Build and Run the Containers Execute the following command from the root of the project directory:

    docker compose up --build
    • The --build flag is necessary on the first run to build the custom Docker image defined in the Dockerfile.
    • First-Time Run: The initial build will take several minutes. After the build, when the deepstream-app starts for the first time, it will take a few more minutes to build the YOLOv11 TensorRT .engine file. This is a one-time process for your specific GPU architecture. Subsequent runs will be much faster.

How to Verify the Output

Once the containers are running, you can verify the output in two ways:

1. Video File Output

The pipeline is configured to save a tiled video of the processed streams to /app/output/deepstream_output.mp4 inside the container, which is mounted to the local ./output directory.

  • The output file will be automatically saved to the output/ directory in your project folder as deepstream_output.mp4.

2. MQTT Metadata

The primary output is the metadata sent to the Mosquitto MQTT broker. You can subscribe to the deepstream_topic to see the real-time JSON data.

  • If you don't have an MQTT client, you can install mosquitto-clients on your host machine:
    sudo apt-get update && sudo apt-get install mosquitto-clients
  • Subscribe to the topic:
    mosquitto_sub -h localhost -t deepstream_topic -p 1883 -v
    You should see a continuous stream of JSON objects, each representing an object detected in the video frames.

Credits

This project heavily relies on the work done in the DeepStream-Yolo repository by Marcos Luciano. A huge thank you to him for providing the custom parsers and integration logic that make running YOLO models in DeepStream possible.

About

Production-shaped edge computer vision stack: YOLOv11 inference on NVIDIA DeepStream with MQTT/Mosquitto messaging, fully containerized for industrial edge deployment.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages