Welcome to Jetson Orin NX Developer Kit repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
05.License plate detection and recognition
TAO LPDNet and LPRNet license plate detection and recognition
TAO LPDNet and LPRNet license plate 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
TrafficCamNet detects the vehicles first, LPDNet locates the region of the license plate, and LPRNet recognizes the characters on the cropped license plate. The Chinese version and the US version use different models and different dictionaries, so they have to be selected according to the region.
Video/USB/CSI → TrafficCamNet → LPDNet license plate detection → LPRNet character recognition→ the preview/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_lpr_china.txtgrep -E "uri=|config-file=" run_lpr_us.txt# Confirm the models and the dictionariesls -la /opt/nvidia/deepstream/deepstream-9.1/samples/models/tao_pretrained/lprnet_vdeployable_onnx_v1.1/ls -la /opt/nvidia/deepstream/deepstream-9.1/samples/models/tao_pretrained/lpdnet_vpruned_v2.3.1/ls -la ~/deepstream_tao_apps/apps/tao_others/deepstream_lpr_app/dict_ch.txtls -la ~/deepstream_tao_apps/apps/tao_others/deepstream_lpr_app/dict_us.txt
Confirm that the material of the target region exists. The real-time camera uses the Jetson desktop/VNC; the camera image should have clear and sufficiently large vehicles and license plates.
3. Start the detection
The Chinese version (the video):
xxxxxxxxxxcd ~/deepstream_tao_demo && export DISPLAY=:0 && ./run_lpr_cn.sh

The US version (the video):
xxxxxxxxxxcd ~/deepstream_tao_demo && export DISPLAY=:0 && ./run_lpr_us.sh /absolute/path/us.mp4

The corresponding inputs are:
The Chinese version:
~/Videos/Video007.mp4The US version:
~/Videos/us.mp4; if it does not exist, the script uses02.DeepStream development/02.License plate detection and recognition/Test cases/us.mp4
The corresponding configuration files:
The Chinese version:
~/deepstream_tao_apps/deepstream_app_tao_configs/run_lpr_china.txtThe US version:
~/deepstream_tao_apps/deepstream_app_tao_configs/run_lpr_us.txt
The license plate boxes and the character text represent the result of the localization stage and of the recognition stage respectively.
To replace the test video: pass the absolute path directly to run_lpr_cn.sh or run_lpr_us.sh; the script generates a temporary configuration and it does not rewrite the template in the repository any more. You must not only replace the material while still using the model/dictionary of the other region.
4. The real-time detection with a USB camera
The LPR USB entry uses the parameter of the specified region. First check the USB camera node and the formats:
xxxxxxxxxxls -l /dev/video*v4l2-ctl -d /dev/video0 --list-formats-ext
The Chinese version:
xxxxxxxxxxcd ~/deepstream_tao_demo && export DISPLAY=:0 && ./run_case.sh lpr_china usb
The US version:
xxxxxxxxxxcd ~/deepstream_tao_demo && export DISPLAY=:0 && ./run_case.sh lpr_us usb

The real-time preview does not produce an offline MP4; the recognition result depends on the resolution of the camera, on the shutter/motion blur and on the pixel size of the license plate in the frame.
Press Ctrl+C once and wait for the application to exit and for the camera to be released.
5. The real-time detection with a CSI camera
The CSI entry supports the real-time preview; it uses the Jetson Argus instead of the USB V4L2 device path. After connecting a compatible module and confirming that the driver and the Argus work normally, run:
The Chinese version:
xxxxxxxxxxcd ~/deepstream_tao_demo && export DISPLAY=:0 && ./run_case.sh lpr_china csi
The US version:
xxxxxxxxxxcd ~/deepstream_tao_demo && export DISPLAY=:0 && ./run_case.sh lpr_us csi

CSI uses the native Argus type=5 and it does not read /dev/video10. The entry supports the real-time preview and it does not produce an MP4.
6. Frequently asked questions
| Symptom | The check and the handling |
|---|---|
| There are no license plate boxes | First confirm that the vehicle detection boxes are normal, and then check the visibility and the size of the license plate and the LPDNet configuration. The Chinese and the US plates must not use the wrong LPD: the Chinese one uses sgie_lpd_DetectNet2_ch.txt and the US one uses sgie_lpd_DetectNet2_us.txt. |
| There are license plate boxes but no text | Check the LPRNet engine, the crop and the log of the recognition stage. |
| The characters are garbled/the region does not match | Check the run script, the model version and dict_ch.txt/dict_us.txt. |
open dictionary file failed + std::bad_alloc | The current working directory has no dict.txt, or the symlink points to a file that does not exist. The six scripts already have the dictionary switching logic built in, so you can use run_lpr_*.sh directly. |
| The US plate shows garbled Chinese | Confirm that you use run_lpr_us*.sh; the script switches to LPDNet_usa + us_lprnet + dict_us. |
| There is no image with USB | Check the node, the format, the permissions, the occupancy and the display session. The resolution has to match the camera-width/camera-height/camera-fps in the configuration file (640x480@15 in the YUYV mode). |
| The CSI did not start | Do not switch manually to the writer; the script stops the relay internally and opens the Argus directly. Check the module, the sensor driver, nvargus-daemon and whether the camera is in use. |
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