Blue Iris and CodeProject.AI ALPR

war4peace

Young grasshopper
Joined
Oct 17, 2023
Messages
53
Reaction score
19
Location
Romania
While I had seen that in previous thread pages, I had assumed it would have been resolved :)
No worries, I'll wait, there's no rush. It's going to be at least a couple months until i install my street cameras anyway. Just wanted to make sure I'm not doing womething wrong.
Appreciate your quick answer!
 

rdagger

Young grasshopper
Joined
Oct 14, 2016
Messages
72
Reaction score
27
I just switched from DeepStack with Plate Recognizer to Code Project AI running on a 6th gen i5 in Windows. So far it works, but the license plate OCR is not performing as well as Plate Recognizer. There are a lot of mismatches between Z and 2, W and H, 4 and L, 5 and S. Nonexistent spaces are also added. I tried adjusting the rotation, but it didn't help.

Are there guidelines on adjusting PLATE_RESCALE_FACTOR, OCR_OPTIMAL_CHARACTER_HEIGHT and OCR_OPTIMAL_CHARACTER_WIDTH. Or are there any other settings I can tweak?

Here's an example of a captured license plate that was misread:
 

Attachments

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,219
Reaction score
4,265
Location
Brooklyn, NY
I just switched from DeepStack with Plate Recognizer to Code Project AI running on a 6th gen i5 in Windows. So far it works, but the license plate OCR is not performing as well as Plate Recognizer. There are a lot of mismatches between Z and 2, W and H, 4 and L, 5 and S. Nonexistent spaces are also added. I tried adjusting the rotation, but it didn't help.

Are there guidelines on adjusting PLATE_RESCALE_FACTOR, OCR_OPTIMAL_CHARACTER_HEIGHT and OCR_OPTIMAL_CHARACTER_WIDTH. Or are there any other settings I can tweak?

Here's an example of a captured license plate that was misread:
You can try adjusting the OCR_OPTIMAL_CHARACTER_WIDTH, if you are getting a lot of 2s being read as Z then try decreasing the WIDTH by 2 then test for a day or two. After making the change you need to restart CodeProject.AI service.
 

rdagger

Young grasshopper
Joined
Oct 14, 2016
Messages
72
Reaction score
27
You can try adjusting the OCR_OPTIMAL_CHARACTER_WIDTH, if you are getting a lot of 2s being read as Z then try decreasing the WIDTH by 2 then test for a day or two. After making the change you need to restart CodeProject.AI service.
Unfortunately, I'm still only getting correct OCR results about 50% of the time. Getting more mismatches such as D to 0, 0 to O, L to 1 and Z to 7 and some characters just being dropped.

What are the units for OCR_OPTIMAL_CHARACTER_WIDTH and how do they relate to the pixel size of the plate? Are there any other settings that could be tweaked?

I don't know a lot about training AI but if I were to take about 1000 actual images of different car plates taken by my camera, could I improve the PaddleOCR recognition?

Here's another misread pic:
 

Attachments

Last edited:

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,219
Reaction score
4,265
Location
Brooklyn, NY
Unfortunately, I'm still only getting correct OCR results about 50% of the time. Getting more mismatches such as D to 0, 0 to O, L to 1 and Z to 7 and some characters just being dropped.

What are the units for OCR_OPTIMAL_CHARACTER_WIDTH and how do they relate to the pixel size of the plate? Are there any other settings that could be tweaked?

I don't know a lot about training AI but if I were to take about 1000 actual images of different car plates taken by my camera, could I improve the PaddleOCR recognition?

Here's another misread pic:
If you want to try a newer OCR model you can replace the files in the below folder with the attached zip files. This model is suppose to have about 6% increase in accuracy.
For training, I have been looking into retraining the model. I am thinking of having the option to save training data. Most likely I will not get to it until early next year.

1698276410614.png
 

Attachments

Last edited:

Perplexed

Getting the hang of it
Joined
Sep 5, 2022
Messages
70
Reaction score
98
Location
USA
I’ve noticed increased lag when turn on ALPR with Code Project.

Without ALPR running, I average 100-150ms on images sent to code project, however after turning on ALPR everything jumps to 500-750 (likely due to the sensitivity to motion the LPR camera is set to, a LOT of images).

I’m currently running straight CPU on an i7-8700, attempting to use the iGPU netted the same lag.

I’ve tossed around the thought of picking up a GPU for dedicated use with CodeProject. Is there a specific GPU/Model that works well? I figured I wouldn’t need a cutting-edge card for it.

In the meantime I installed a second instance of CP for the LPR in a docker container on a different system. Now that server runs 750ms on average (I’m okay with slower processing for the LPR) and maintain the oringal CP install for object recognition on the primary machine — back down to 100-150ms.
 

actran

Getting comfortable
Joined
May 8, 2016
Messages
806
Reaction score
732
@Perplexed Yes, offloading to GPU is going to eliminate AI burden on your CPU. I personally have Nvidia GTX 1650 because it's still "recent" enough but low power --- running 24x7 on my BI5 Optiplex with original power supply.

Make sure to get at least 4GB RAM on Nvidia card to support the models you may decide to use because IMHO 2GB RAM GPU is just not enough.

P.S. Check with CodeProject.AI website for list of supported Nvidia cards.
 
Last edited:

prsmith777

Getting comfortable
Joined
Dec 23, 2019
Messages
269
Reaction score
384
Location
Colorado
Im on license plater reader version 2.5.
Is there a newer version?
My plate accuracy is sometime not that good. Maybe trying a newer version might help?
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,219
Reaction score
4,265
Location
Brooklyn, NY
Im on license plater reader version 2.5.
Is there a newer version?
My plate accuracy is sometime not that good. Maybe trying a newer version might help?
The current version is 2.7.2 should be about the same accuracy as 2.5

1701567105298.png
 

wpiman

Pulling my weight
Joined
Jul 16, 2018
Messages
332
Reaction score
246
Location
massachusetts
Look at what just showed up for an installation option for me! The Orange Pi 5 acceleration library...

Screenshot 2023-12-05 at 2.35.55 PM.png

Looks like the processing and inference times are down by about 50%! Left is the Orange Pi 5. Right is a Ubuntu Xeon E3. Nice job Mike.

Screenshot 2023-12-05 at 2.37.45 PM.png

I have a Windows machine with the Dual Coral TPUs in them. Has anyone does license plate recognition with them?
 

prsmith777

Getting comfortable
Joined
Dec 23, 2019
Messages
269
Reaction score
384
Location
Colorado
I've noticed something since upgrading to CPAI 2.3.4 and LPR 2.7.2

LPR is using CPU and I see nowhere where I can change to GPU(CUDA). I am running CUDA 11.8 and YOLOv5 6.2 is using GPU(CUDA) without any issues

Untitled3.png

I tried uninstalling and reinstalling and same problem

There is an error in the log about a missing cfg file:

13:12:17:Installing module 'ALPR'
13:12:17:ALPR: Installing CodeProject.AI Analysis Module
13:12:17:ALPR: ========================================================================
13:12:17:ALPR: CodeProject.AI Installer
13:12:17:ALPR: ========================================================================
13:12:17:ALPR: General CodeProject.AI setup
13:12:17:ALPR: Creating Directories...Done
13:12:17:ALPR: GPU support
13:12:17:ALPR: CUDA Present...Yes (version 11.8)
13:12:17:ALPR: ROCm Present...False
13:12:18:ALPR: Installing module ALPR 2.7.2
13:12:18:ALPR: Installing Python 3.7
13:12:18:ALPR: Python 3.7 is already installed
13:12:18:ALPR: Creating Virtual Environment (Local)...Virtual Environment already present
13:12:18:ALPR: No pyvenv.cfg file
13:12:18:ALPR: Confirming we have Python 3.7 in our virtual environment...
13:12:18:ALPR: -------------------------------------------------------------
13:12:18:ALPR: Error: Python not installed
13:12:18:ALPR: Downloading ALPR models...already exists...Expanding...Done.
13:12:18:ALPR: Copying contents of paddleocr-models.zip to paddleocr...done
13:12:18:ALPR: Cleaning up...done
13:12:18:ALPR: Installing Python packages for ALPR
13:12:18:ALPR: [0;Installing GPU-enabled libraries: If available
13:12:18:ALPR: Ensuring Python package manager (pip) is installed...Done
13:12:18:ALPR: Ensuring Python package manager (pip) is up to date...Done
13:12:18:ALPR: Python packages specified by requirements.windows.cuda11_8.txt
13:12:19:ALPR: - Installing PaddlePaddle, Parallel Distributed Deep Learning...(✔ checked) Done
13:12:19:ALPR: - Installing PaddleOCR, the OCR toolkit based on PaddlePaddle...(✔ checked) Done
13:12:19:ALPR: - Installing imutils, the image utilities library...(✔ checked) Done
13:12:19:ALPR: - Installing Pillow, a Python Image Library...(✔ checked) Done
13:12:19:ALPR: - Installing OpenCV, the Computer Vision library for Python...(✔ checked) Done
13:12:19:ALPR: - Installing NumPy, a package for scientific computing...(✔ checked) Done
13:12:19:ALPR: Installing Python packages for the CodeProject.AI Server SDK
13:12:19:ALPR: Ensuring Python package manager (pip) is installed...Done
13:12:19:ALPR: Ensuring Python package manager (pip) is up to date...Done
13:12:19:ALPR: Python packages specified by requirements.txt
13:12:19:ALPR: - Installing Pillow, a Python Image Library...(✔ checked) Done
13:12:19:ALPR: - Installing Charset normalizer...(✔ checked) Done
13:12:19:ALPR: - Installing aiohttp, the Async IO HTTP library...(✔ checked) Done
13:12:19:ALPR: - Installing aiofiles, the Async IO Files library...(✔ checked) Done
13:12:20:ALPR: - Installing py-cpuinfo to allow us to query CPU info...(✔ checked) Done
13:12:20:ALPR: - Installing Requests, the HTTP library...(✔ checked) Done
13:12:20:ALPR: Setup complete
13:12:20:Module ALPR installed successfully.
13:12:20:
13:12:20:Module 'License Plate Reader' 2.7.2 (ID: ALPR)
13:12:20:Module Path: C:\Program Files\CodeProject\AI\modules\ALPR
13:12:20:AutoStart: True
13:12:20:Queue: alpr_queue
13:12:20:platforms: windows,linux,linux-arm64,macos,macos-arm64,!orangepi,!jetson
13:12:20:GPU Libraries: installed if available
13:12:20:GPU Enabled: enabled
13:12:20:parallelism: 0
13:12:20:Accelerator:
13:12:20:Half Precis.: enable
13:12:20:Runtime: python3.7
13:12:20:Runtime Loc: Local
13:12:20:FilePath: ALPR_adapter.py
13:12:20:pre installed: False
13:12:20:Start pause: 1 sec
13:12:20:LogVerbosity:
13:12:20:Valid: True
13:12:20:Environment Variables
13:12:20:AUTO_PLATE_ROTATE = True
13:12:20:MIN_COMPUTE_CAPABILITY = 7
13:12:20:MIN_CUDNN_VERSION = 7
13:12:20:OCR_OPTIMAL_CHARACTER_HEIGHT = 60
13:12:20:OCR_OPTIMAL_CHARACTER_WIDTH = 36
13:12:20:OCR_OPTIMIZATION = True
13:12:20:pLATE_CONFIDENCE = 0.7
13:12:20:pLATE_RESCALE_FACTOR = 2
13:12:20:pLATE_ROTATE_DEG = 0
13:12:20:
13:12:20:Started License Plate Reader module
13:12:20:Installer exited with code 0
13:12:20:Call to run Install on module ALPR has completed.
13:12:20:ALPR_adapter.py: No pyvenv.cfg file
13:12:20:Module ALPR has shutdown
13:12:20:ALPR_adapter.py: has exited
13:12:21:Module ALPR started successfully.
 

actran

Getting comfortable
Joined
May 8, 2016
Messages
806
Reaction score
732
@prsmith777 Clear your browser cache/history or use Chrome incognito mode. Perhaps, you have old UI cached.

If that doesn't work, maybe uninstall LPR module and then reinstall.
 

prsmith777

Getting comfortable
Joined
Dec 23, 2019
Messages
269
Reaction score
384
Location
Colorado
Clearing cache didn't seem to help. Here is the LPR info:

Module 'License Plate Reader' 2.7.2 (ID: ALPR)
Module Path: <root>\modules\ALPR
AutoStart: True
Queue: alpr_queue
Platforms: windows,linux,linux-arm64,macos,macos-arm64,!orangepi,!jetson
GPU Libraries: installed if available
GPU Enabled: enabled
Parallelism: 0
Accelerator:
Half Precis.: enable
Runtime: python3.7
Runtime Loc: Local
FilePath: ALPR_adapter.py
Pre installed: False
Start pause: 1 sec
LogVerbosity:
Valid: True
Environment Variables
AUTO_PLATE_ROTATE = True
MIN_COMPUTE_CAPABILITY = 7
MIN_CUDNN_VERSION = 7
OCR_OPTIMAL_CHARACTER_HEIGHT = 60
OCR_OPTIMAL_CHARACTER_WIDTH = 36
OCR_OPTIMIZATION = True
PLATE_CONFIDENCE = 0.7
PLATE_RESCALE_FACTOR = 2
PLATE_ROTATE_DEG = 0
Started: 05 Dec 2023 1:12:20 PM Mountain Standard Time
LastSeen: Not seen
Status: Started
Processed: 0
Provider:
CanUseGPU: False
HardwareType: CPU
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,219
Reaction score
4,265
Location
Brooklyn, NY
Clearing cache didn't seem to help. Here is the LPR info:

Module 'License Plate Reader' 2.7.2 (ID: ALPR)
Module Path: <root>\modules\ALPR
AutoStart: True
Queue: alpr_queue
Platforms: windows,linux,linux-arm64,macos,macos-arm64,!orangepi,!jetson
GPU Libraries: installed if available
GPU Enabled: enabled
Parallelism: 0
Accelerator:
Half Precis.: enable
Runtime: python3.7
Runtime Loc: Local
FilePath: ALPR_adapter.py
Pre installed: False
Start pause: 1 sec
LogVerbosity:
Valid: True
Environment Variables
AUTO_PLATE_ROTATE = True
MIN_COMPUTE_CAPABILITY = 7
MIN_CUDNN_VERSION = 7
OCR_OPTIMAL_CHARACTER_HEIGHT = 60
OCR_OPTIMAL_CHARACTER_WIDTH = 36
OCR_OPTIMIZATION = True
PLATE_CONFIDENCE = 0.7
PLATE_RESCALE_FACTOR = 2
PLATE_ROTATE_DEG = 0
Started: 05 Dec 2023 1:12:20 PM Mountain Standard Time
LastSeen: Not seen
Status: Started
Processed: 0
Provider:
CanUseGPU: False
HardwareType: CPU
This should be fixed with the next release of CodeProject.AI which should be released soon. See link below on how the manually fix the issue.
 
Top