Welcome to Jetson Orin NX Developer Kit repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
08.Retail product detection and recognition
TAO retail product detection and recognition
TAO retail product detection and recognition1. Case goal and processing flow2. The checks before running it3. Start the detection4. The real-time detection with a USB camera5. The real-time detection with a CSI camera6. Frequently asked questions7. References
Applicable environment: Jetson Orin NX, JetPack 7.2.1, DeepStream 9.1.
1. Case goal and processing flow
Retail Object Detection (DINO) is responsible for locating the products on the shelf. It is not a single-label classification of the whole shelf image.
Video/USB/CSI → the product detection (Retail DINO) → the preview and the video output
2. The checks before running it
xcd ~/deepstream_tao_apps/deepstream_app_tao_configs# Confirm the configuration and the input sourcegrep -E "uri=|config-file=" run_retail.txt# Confirm the custom ONNX and the enginels -la ~/deepstream_tao_apps/models/retail/# Confirm the original model (it comes with the DS)ls -la /opt/nvidia/deepstream/deepstream-9.1/samples/models/tao_pretrained/retail_object_detection_vdeployable_100_onnx_v1.0/
Confirm that the material and the output directory are available. The camera mode needs the graphical desktop/VNC; for the USB check the device node and for the CSI confirm that the sensor and the Argus are ready.
Key: the score_threshold of the Retail DINO ONNX has been changed from 0.4 to 0.1, and it is stored as ~/deepstream_tao_apps/models/retail/retail_detector_100_v2.onnx.
3. Start the detection
The video mode:
xxxxxxxxxxexport DISPLAY=:0 && ~/deepstream_tao_demo/run_case.sh retail video

The input is the retail video sample/streams/retail_object_h264.mp4 that comes with DeepStream. The detection boxes and the category labels are the product of the same stage; the course configuration uses the cyan-blue detection boxes that are consistent with the tutorial.
After the EOS, check the output of the pipeline. The current configuration generates retail_out.mp4:
xxxxxxxxxxls -la ~/deepstream_tao_apps/deepstream_app_tao_configs/retail_out.mp4
To replace the test video: modify the uri=file:// of the [source0] section in run_retail.txt to the absolute path of a retail MP4/H.264 file on the Jetson itself. Use gst-discoverer-1.0 to confirm that it can be decoded; it is best if the material contains clear products on the shelf. Keep the original video and the outputs that you need.
The first run compiles the Retail DINO engine (about 11 minutes); the second start loads it instantly.
4. The real-time detection with a USB camera
Connect the camera, check the node and the formats and then start it in a graphical session:
xxxxxxxxxxls -l /dev/video*v4l2-ctl -d /dev/video0 --list-formats-extexport DISPLAY=:0 && ~/deepstream_tao_demo/run_case.sh retail usb

The script detects the USB camera node automatically through ~/deepstream_tao_demo/find_usb_cam.sh.
The real-time camera entry only previews and it does not produce an offline MP4.
Press Ctrl+C once, wait for the application to exit and confirm that the camera has been released. The Retail DINO has a high load; on the Orin NX the video mode is about 21 FPS and the USB mode is about 15 FPS.
5. The real-time detection with a CSI camera
Start:
xxxxxxxxxxexport DISPLAY=:0 && ~/deepstream_tao_demo/run_case.sh retail csi

The CSI camera entry supports the real-time preview and it does not produce an offline video output. To stop it, press Ctrl+C once and wait for the application and the camera streaming to exit.
6. Frequently asked questions
| Symptom | The check and the handling |
|---|---|
| The products cannot be detected | Look at the log of the detection model, at the scale of the image and at the occlusion; confirm that the input material contains a shelf. |
| The labels are garbled (an INT32 parsing error) | Confirm that the pgie configuration uses NvDsInferParseCustomEfficientDetTAO (and not the default NvDsInferParseCustomBatchedNMSTLT). |
| There are too many boxes/the boxes are noisy | Confirm that the score_threshold of the ONNX has been changed from 0.4 to 0.1; cluster-mode=2 + nms-iou-threshold=0.3. |
Failed to load config file | Check the config-file= path in run_retail_csi.txt (the trap of the path missing the configs/ prefix was hit before). |
| The engine fails to load | The old engine was built with TRT 10 and it fails under DS 9.1; delete ~/deepstream_tao_apps/models/retail/*.engine so that the DS rebuilds it automatically. |
| There is no image with USB | Check the node, the format, the permissions, the occupancy and the display session. |
| There is no image with CSI | Check the connection of the compatible sensor, the driver, the Argus service and whether the camera is in use; this entry directly uses the Argus type=5. |
| The accuracy of the labels is limited | The model only recognizes the 100 product categories of the training set; a product that is not in the training set gets the "most similar" category. |
nvv4l2h264enc has no property named 'gpu-id' | It is a known non-blocking warning of DS 9.1 and it does not affect the inference or the display. |
7. References
The NVIDIA DeepStream TAO application examples: https://github.com/NVIDIA/DeepStream/tree/main/src/apps/tao_apps
The DeepStream TAO integration documentation: https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_TAO_integration.html