Welcome to Jetson Orin NX Developer Kit repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
03.Parallel multi-model inference
DeepStream parallel multi-model inference
Applicable environment: JetPack 7.2.1, Ubuntu 24.04, DeepStream 9.1, Jetson Orin NX. Complete the DeepStream environment setup first and confirm that the basic USB or CSI camera cases can run.
The factory system already provides the DeepStream, the models, the TensorRT engines, the course startup entry and the compatible configuration that this case needs. In normal use you start directly from section 3 and choose the input source to run; the deployment commands of this section are only for reference when the environment is missing, has to be restored or has to be redeployed.
1. Factory environment and first deployment reference
The factory system already contains:
The three startup scripts for the video, the USB and the CSI under
~/deepstream_tao_demo/.The TAO pretrained models and the TensorRT engines required by TrafficCamNet and PeopleNet.
The plugins required by the GStreamer pipeline and the
nvdsmetamuxmetadata merging plugin.
Therefore you must not run the commands of this section again; only when the environment is missing, has to be restored or you deploy it yourself, follow the steps below in this order.
1.1 Confirm that the models are in place
ls -la /opt/nvidia/deepstream/deepstream-9.1/samples/models/tao_pretrained/trafficcamnet_vpruned_onnx_v1.0.4/ls -la /opt/nvidia/deepstream/deepstream-9.1/samples/models/tao_pretrained/peoplenet_vdeployable_quantized_onnx_v2.6.3/

1.2 Build the common TAO parser (only needed the first time)
xxxxxxxxxxcd ~/deepstream_tao_apps/post_processorexport CUDA_VER=13.2make cleanmakels -la libnvds_infercustomparser_tao.so
2. Case goal
This case derives four display tiles from the same video frame or the same camera frame: the original image, TrafficCamNet, PeopleNet and the merged metadata result of the two models.
The final window is a 2×2 four-tile layout:
| Tile | Content that it displays |
|---|---|
| Top left | The original image |
| Top right | TrafficCamNet + Tracker + NVDS Analytics |
| Bottom left | PeopleNet |
| Bottom right | The merged metadata result of TrafficCamNet and PeopleNet |
The four tiles are composited into the same window by the compositor; the bottom right merges the metadata of the two inference branches with nvdsmetamux.
For USB/CSI, the camera is captured only once; DeepStream copies the same frame internally with a tee and does not open the camera again.
3. Script startup: choose the input source
The current unified startup script is located in ~/deepstream_tao_demo/:
xxxxxxxxxxcd ~/deepstream_tao_demo
| Input source | Command | Applicable scenario |
|---|---|---|
| Local video | ./run_4grid.sh | The default sample_720p.h264, to verify the overlay effect of the two models |
| USB camera | ./run_parallel_gst_usb.sh | Real-time input of a UVC/V4L2 USB camera |
| CSI camera | ./run_parallel_gst_csi.sh | Real-time input of a MIPI CSI camera |
All three entries display a single window in real time and do not write a video file.
4. Local video verification
For the first run it is recommended to start with the local video and confirm that the two models, the four tiles and the display environment are correct:
xxxxxxxxxxcd ~/deepstream_tao_demo && export DISPLAY=:0 && ./run_4grid.sh

The default video: /opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264
Replace the video:
xxxxxxxxxx./run_parallel_gst.sh /path/to/your_video.mp4
/path/to/your_video.mp4 is the path of the video that you want to run the detection on
5. Real-time verification with the CSI camera
Run:
xxxxxxxxxxcd ~/deepstream_tao_demo./run_parallel_gst_csi.sh
By default it uses the CSI sensor-id=0, wbmode=1 (automatic white balance) and an exposure compensation of 0. When the plugin supports
sensor-mode, it requests mode 3; when it does not, the mode is selected by the 1920x1080@30 caps.
6. Real-time verification with the USB camera
Prerequisites (confirm the USB camera node and the supported formats):
xxxxxxxxxxv4l2-ctl --list-devicesv4l2-ctl -d /dev/video0 --list-formats-ext
The script detects the USB camera node automatically through ~/deepstream_tao_demo/find_usb_cam.sh, so there is no need to specify it manually.
Run:
xxxxxxxxxxcd ~/deepstream_tao_demo./run_parallel_gst_usb.sh
The USB camera uses 640x480@15fps by default in the YUYV mode (a USB 2.0 bandwidth limit). If a higher resolution is needed, the camera must support the MJPG mode; the script currently takes the YUYV path by default.
7. Dual-model parallel processing chain
The processing chain is:
xxxxxxxxxxVideo source/camera → nvv4l2decoder → nvstreammux↓tee┌─────────┴─────────┐↓ ↓nvinfer1 nvinfer2(TrafficCamNet) (PeopleNet)↓ ↓mm.sink_0 mm.sink_1└─────────┬─────────┘↓nvdsmetamux↓nvvideoconvert → nvdsosd → nvvideoconvert → xvimagesink
TrafficCamNet detects traffic targets such as vehicles, bicycles and road signs.
PeopleNet detects person targets such as people, faces and bags.
nvdsmetamuxmerges the metadata of the two branches into one stream and then sends it tonvdsosdto draw the boxes uniformly.
Key configuration (already set up in the script):
TrafficCamNet uses
gie-unique-id=1, with the configuration filepgie_trafficcamnet_config.txt.PeopleNet uses
gie-unique-id=2, with the configuration fileconfig_infer_primary_peoplenet_id2.txt(batch-size=1, matching the b1 engine).The outputs of the two GIE are fed into
nvdsmetamuxthroughqueue ! mm.sink_X.
8. Output and stopping
The real-time window is displayed on the desktop of the Jetson device itself or on the VNC desktop. None of the three scripts writes a video file.
Press Ctrl+C once in the terminal where the command runs to stop it normally.
9. Common phenomena
| Symptom | Handling |
|---|---|
| Only one set of boxes is visible and the two sets cannot be told apart | There should be 2 Load new model entries in the log (UID 1 + UID 2); the boxes of the same color overlay each other and are hard to distinguish visually, so check the log to confirm |
| The USB version fails to start | Run v4l2-ctl --list-formats-ext and check the device number, the resolution and the frame rate |
| The CSI cannot be opened | Confirm that sensor-id=0 corresponds to the actual camera and check the Argus and the camera occupancy; the script stops the pose/OCR relay first |
The terminal reports not-negotiated | The resolution of the USB camera does not match the caps of the script; change width/height/framerate in the script |
| The picture stutters | The two models are inferred at the same time; the FPS is about 15-20 on the Orin NX, which is normal |