Skip to content

Before Installing DeepStream

Make sure that you have set up the dev container prior to attempting install.

General

In order to run inference, an NVIDIA 20x series GPU or newer is required.

This will not work on macOS and ARM systems.

Installing DeepStream

There are two ways to install DeepStream.

  • With the DeepStream dev container
  • Through an installation script

DeepStream Dev Container

The easiest method is to switch to the DeepStream dev container, vtautoboat/development_image_deepstream. See how to change your your dev container variant.

DeepStream Installation Script

Inside the dev container, make sure your current working directory is /home/ws/.

Execute this script to start the installation.

bash .devcontainer/old_devcontainer_variant_setup_scripts/install_deepstream_yolo_dev_container.sh

This installation can take a long time.

Connecting the Camera

Running without camera

If you do not want to run with the camera, or do not have it, run

export CAMERA=false

In order to run the object detection module, the camera must be connected and forwarded to WSL

To forward the camera device to WSL, follow these instructions

Making sure the camera is seen in WSL

To verify the connection, run this command in the dev container

v4l2-ctl --list-devices

A properly connected camera will have an output similar to this (the numbers may be different)

autoboat_user@docker-desktop:/home/ws$ v4l2-ctl --list-devices
Intel(R) RealSense(TM) Depth Ca (usb-0000:00:14.0-1):
        /dev/video0
        /dev/video1
        /dev/video2
        /dev/video3
        /dev/video4
        /dev/video5
        /dev/media1
        /dev/media2

Building an Engine File

Running without inference

If you want to disable inference and skip the model creation, run

export INFERENCE=false

To build an engine file, navigate to the scripts directory. This can be done without a camera connected.

cd /home/ws/scripts/

You need to know whether this model is Yolo26 or Yolo11.

Place the .pt model file in this directory.

Run the following script to build a .engine model file based on the .pt file. This will take a while. Fill in <name_of_pt_file> without the file extension. For example, if your model is named yolo26s.pt, you should enter yolo26s.

# Build an engine file
bash build_engine_file_yolo.sh <yolo_version> <name_of_pt_file>

# For example with model file named yolo26s.pt
bash build_engine_file_yolo.sh 26 yolo26s

# For example with model file named yolo11n.pt
bash build_engine_file_yolo.sh 11 yolo11n

You will see a couple warnings similar to shown below. Those are normal.

Build Warnings

After running the script, the file will be moved to the ros_pacakges/object_detection/object_detection/config/yolo<ver>/pt_files/ directory. The script will look for files in both the scripts/ directory and pt_files/ directory, if it exists.

Running the Object Detection Module

After a model file has been created, you can run the ROS2 object detection module.

ros2 run object_detection object_detection

If you disabled the camera, the video feed will be static.

For more information and dynamically changing parameters, see the Object Detection Node.