Sync license-plate-recognition from metro-analytics-catalog
Browse files- .gitattributes +1 -0
- README.md +15 -14
- expected_output_dlstreamer.gif +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
expected_output_dlstreamer.gif filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
# License Plate Recognition
|
| 2 |
|
| 3 |
-
> **Validated with:** OpenVINO 2026.1.0, DLStreamer 2026.0, Python 3.11+
|
| 4 |
-
|
| 5 |
| Property | Value |
|
| 6 |
|---|---|
|
| 7 |
| **Category** | Object Detection + Optical Character Recognition |
|
|
@@ -114,7 +112,7 @@ A buffer probe extracts the recognized text from the inference metadata
|
|
| 114 |
attached to each frame.
|
| 115 |
The input is `ParkingVideo.mp4`, the short parking-lot clip downloaded by
|
| 116 |
`export_and_quantize.sh` into the current directory.
|
| 117 |
-
The annotated stream is muxed into `
|
| 118 |
|
| 119 |
```python
|
| 120 |
import os
|
|
@@ -138,17 +136,17 @@ OCR_XML = (
|
|
| 138 |
"ch_PP-OCRv4_rec_infer/ch_PP-OCRv4_rec_infer.xml"
|
| 139 |
)
|
| 140 |
INPUT_VIDEO = "ParkingVideo.mp4"
|
| 141 |
-
DEVICE = "
|
| 142 |
-
PREPROC = "pre-process-backend=opencv"
|
| 143 |
|
| 144 |
pipeline_str = (
|
| 145 |
-
f"filesrc location={INPUT_VIDEO} ! decodebin3 !
|
| 146 |
-
f"
|
|
|
|
| 147 |
f"videoconvert ! "
|
| 148 |
-
f"gvaclassify model={OCR_XML} device={DEVICE}
|
| 149 |
f"gvawatermark ! videoconvert ! video/x-raw,format=I420 ! "
|
| 150 |
f"openh264enc ! h264parse ! "
|
| 151 |
-
f"mp4mux ! filesink name=sink location=
|
| 152 |
)
|
| 153 |
|
| 154 |
pipeline = Gst.parse_launch(pipeline_str)
|
|
@@ -188,17 +186,16 @@ bus.timed_pop_filtered(
|
|
| 188 |
pipeline.set_state(Gst.State.NULL)
|
| 189 |
```
|
| 190 |
|
| 191 |
-
To run on
|
| 192 |
-
|
| 193 |
-
`
|
| 194 |
-
upstream sample.
|
| 195 |
|
| 196 |
### Try It on a Sample Video
|
| 197 |
|
| 198 |
`export_and_quantize.sh` already downloaded `ParkingVideo.mp4` into the
|
| 199 |
current directory, so the sample is ready to run.
|
| 200 |
Execute the DLStreamer sample above.
|
| 201 |
-
The annotated video is saved to `
|
| 202 |
by `gvawatermark` around every detected plate.
|
| 203 |
The buffer probe prints one line per detected plate per frame.
|
| 204 |
|
|
@@ -221,6 +218,10 @@ If you only need the structured output and not the annotated video, replace `fil
|
|
| 221 |
> video is encoded correctly. The warning comes from the OpenH264 library's
|
| 222 |
> internal logging and does not indicate a real error.
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
---
|
| 225 |
|
| 226 |
## License
|
|
|
|
| 1 |
# License Plate Recognition
|
| 2 |
|
|
|
|
|
|
|
| 3 |
| Property | Value |
|
| 4 |
|---|---|
|
| 5 |
| **Category** | Object Detection + Optical Character Recognition |
|
|
|
|
| 112 |
attached to each frame.
|
| 113 |
The input is `ParkingVideo.mp4`, the short parking-lot clip downloaded by
|
| 114 |
`export_and_quantize.sh` into the current directory.
|
| 115 |
+
The annotated stream is muxed into `output_dlstreamer.mp4` with H.264 (OpenH264).
|
| 116 |
|
| 117 |
```python
|
| 118 |
import os
|
|
|
|
| 136 |
"ch_PP-OCRv4_rec_infer/ch_PP-OCRv4_rec_infer.xml"
|
| 137 |
)
|
| 138 |
INPUT_VIDEO = "ParkingVideo.mp4"
|
| 139 |
+
DEVICE = "GPU"
|
|
|
|
| 140 |
|
| 141 |
pipeline_str = (
|
| 142 |
+
f"filesrc location={INPUT_VIDEO} ! decodebin3 ! "
|
| 143 |
+
f"videoconvert ! queue ! "
|
| 144 |
+
f"gvadetect model={DETECTOR_XML} device={DEVICE} ! queue ! "
|
| 145 |
f"videoconvert ! "
|
| 146 |
+
f"gvaclassify model={OCR_XML} device={DEVICE} ! queue ! "
|
| 147 |
f"gvawatermark ! videoconvert ! video/x-raw,format=I420 ! "
|
| 148 |
f"openh264enc ! h264parse ! "
|
| 149 |
+
f"mp4mux ! filesink name=sink location=output_dlstreamer.mp4"
|
| 150 |
)
|
| 151 |
|
| 152 |
pipeline = Gst.parse_launch(pipeline_str)
|
|
|
|
| 186 |
pipeline.set_state(Gst.State.NULL)
|
| 187 |
```
|
| 188 |
|
| 189 |
+
To run on CPU, change `DEVICE = "GPU"` to `DEVICE = "CPU"`.
|
| 190 |
+
For NPU, change `DEVICE = "GPU"` to `DEVICE = "NPU"` and use
|
| 191 |
+
`batch-size=1` and `nireq=4` for best utilization.
|
|
|
|
| 192 |
|
| 193 |
### Try It on a Sample Video
|
| 194 |
|
| 195 |
`export_and_quantize.sh` already downloaded `ParkingVideo.mp4` into the
|
| 196 |
current directory, so the sample is ready to run.
|
| 197 |
Execute the DLStreamer sample above.
|
| 198 |
+
The annotated video is saved to `output_dlstreamer.mp4` with green bounding boxes drawn
|
| 199 |
by `gvawatermark` around every detected plate.
|
| 200 |
The buffer probe prints one line per detected plate per frame.
|
| 201 |
|
|
|
|
| 218 |
> video is encoded correctly. The warning comes from the OpenH264 library's
|
| 219 |
> internal logging and does not indicate a real error.
|
| 220 |
|
| 221 |
+
#### Expected Output
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
|
| 225 |
---
|
| 226 |
|
| 227 |
## License
|
expected_output_dlstreamer.gif
ADDED
|
Git LFS Details
|