This sample demonstrates the License Plate Recognition (LPR) pipeline constructed via gst-launch-1.0 command-line utility.
The sample utilizes GStreamer command-line tool gst-launch-1.0 which can build and run a GStreamer pipeline described in a string format.
The string contains a list of GStreamer elements separated by an exclamation mark !, each element may have properties specified in the format property=value.
This sample builds a GStreamer pipeline of the following elements:
filesrc,urisourcebin, orv4l2srcfor input from file/URL/web-cameradecodebin3for video decodingvideoconvertfor converting video frames into different color formatsvapostprocfor post-processing (used in GPU pipeline)gvadetectfor running the license plate detectorgvaclassifyfor running the OCR modelgvametaconvertfor converting metadata to JSON formatgvametapublishfor publishing metadata to a filegvafpscounterfor measuring FPS (used in FPS mode)fakesinkfor discarding the output
The sample uses the yolov8_license_plate_detector model for license plate detection and the ch_PP-OCRv4_rec_infer model for optical character recognition (OCR). The necessary conversion to the OpenVINO™ format is performed by the download_public_models.sh script located in the samples directory.
The accuracy of license plate detection depends on whether the applied model has been trained using data representing license plates from a specific region. In addition to the default model used in this example, the same pipeline can be used with other license plate detectors, such as the one available here.
export MODELS_PATH="$HOME"/models
cd /opt/intel/dlstreamer/samples/gstreamer/gst_launch/license_plate_recognition/
../../../download_public_models.sh yolov8_license_plate_detector
../../../download_public_models.sh ch_PP-OCRv4_rec_infer
./license_plate_recognition.sh [INPUT] [DEVICE] [OUTPUT]The sample takes three command-line optional parameters:
-
[INPUT] to specify the input source.
The input could be:- local video file
- web camera device (e.g.,
/dev/video0) - RTSP camera (URL starting with
rtsp://) or other streaming source (e.g., URL starting withhttp://)
If the parameter is not specified, the sample by default streams a video example from an HTTPS link (utilizing theurisourcebinelement), so it requires an internet connection.
-
[DEVICE] to specify the device for inference.
You can choose eitherCPU,GPUorAUTO. -
[OUTPUT] to choose between several output modes:
- display - screen rendering
- json - output to a JSON file
- file - output to an mp4 video file
- display-and-json
- fps - FPS only
The sample:
- prints gst-launch command line into console
- starts the command and shows the video with bounding boxes around the detected license plates together with the recognized text, or prints out fps if you set OUTPUT to fps.