This project demonstrates a real-time license plate detection and recognition system built using NVIDIA DeepStream SDK. It uses multiple neural networks in a pipeline to detect vehicles, locate license plates, and perform OCR to read the plate numbers.
- NVIDIA DeepStream SDK 7.1
- Python 3.10
- Gst-python
- NVIDIA GPU with compute capability 6.0 or higher
- Ubuntu 20.04 or 22.04
Number_plate_recognition_Deepstream_OCR_NVIDIA/
├── models/
│ ├── lpdetect/ # License plate detection model
│ ├── lprecog/ # License plate recognition model
│ └── trafficcamnet/ # Vehicle detection model
├── Results/ # Output images and videos
├── nvinfer_custom_lpr_parser/ # Custom parsers for license plate recognition
├── deepstream_number_plate.py # Main application
├── dstest2_pgie_config.txt # Primary detector config
├── dstest2_sgie1_config.txt # Secondary detector config (LP detection)
├── dstest2_sgie2_config.txt # Secondary detector config (LP recognition)
└── dstest2_tracker_config.txt # Object tracker config
-
Primary Detector (pgie):
- ResNet-18 based TrafficCamNet model
- Detects vehicles, road signs, two-wheelers and persons
- INT8 quantized for optimal performance
-
License Plate Detector (sgie1):
- LPDNet model optimized for US license plates
- Detects license plate regions on vehicles
- INT8 quantized
-
License Plate Recognition (sgie2):
- LPRNet model for OCR
- Recognizes alphanumeric characters
- FP16 precision
[File Source] -> [H264 Parser] -> [Decoder] -> [Stream Muxer] ->
[Primary Detector] -> [Tracker] -> [LP Detector] -> [LP Recognition] ->
[Video Converter] -> [On-Screen Display] -> [Video Sink]
- Clone the repository:
git clone <repo-url>
cd Number_plate_recognition_Deepstream_OCR_NVIDIA
- Run the application:
python3 deepstream_number_plate.py -i <path-to-video-file>
For example:
python3 deepstream_number_plate.py -i samples/sample1.mp4
The application provides real-time visualization with:
- Bounding boxes around detected vehicles
- License plate regions highlighted
- Recognized license plate numbers displayed
- Frame statistics (FPS, object counts)
Sample results can be found in the Results/
folder.
The behavior of each neural network can be customized through their respective config files:
dstest2_pgie_config.txt
: Vehicle detector settingsdstest2_sgie1_config.txt
: License plate detector settingsdstest2_sgie2_config.txt
: OCR model settingsdstest2_tracker_config.txt
: Object tracker parameters
Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. Licensed under the Apache License, Version 2.0. See LICENSE file for details.
This project uses models and components from:
- NVIDIA DeepStream SDK
- NVIDIA TAO Toolkit
- NVIDIA TensorRT