Blue Iris and CodeProject.AI ALPR

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,238
Reaction score
4,299
Location
Brooklyn, NY
I've been trying to troubleshoot alpr not returning plate numbers for a few weeks now... since I first attempted to upgrade from CPAI 2.1.9 to 2.1.11. I initially had issues installing the update, but got those sorted. Some things I've tried... deleting all CPAI folders and reinstalling CPAI 1.1.11, updating CUDA to 11.8 (I was using 11.7 successful before), and running the latest cudnn batch file. CPAI OCR apparently is not returning as expected. So of course I can't expect BI to return OCR either. Any help is much appreciated. I think I got all the relevant screen grabs to convey details of my setup, but let me know if additional info might help.

View attachment 172531
View attachment 172532
View attachment 172533
View attachment 172534

FWIW, AI is otherwise working great with BI. I'm getting accurate alerts for people, packages, deliveries, cars, etc... just the alpr ocr function seems broken on my instance. Any advice to help get it working again is very much appreciated.
Post screenshots of your main and camera AI settings.
 

truglo

Pulling my weight
Joined
Jun 28, 2017
Messages
275
Reaction score
103
OK, I'm not sure it will help though since alpr/license-plates v2 in the cpai explorer are not working as they should.

5.png
6.png

FWIW, I also tried it and it failed with my old cam settings as shown below:
7.png
 

truglo

Pulling my weight
Joined
Jun 28, 2017
Messages
275
Reaction score
103
Woah yeah... I did see some weird text like that one time in BI logs. Not sure what's up, but even 1800%?

8.png

[edit: Note I saw the long return time and decided to hit the button again... and now nothing "No Predictions Returned". Something either intermittent, or corrupt after first use?
 

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,238
Reaction score
4,299
Location
Brooklyn, NY
Woah yeah... I did see some weird text like that one time in BI logs. Not sure what's up, but even 1800%?

View attachment 172542

[edit: Note I saw the long return time and decided to hit the button again... and now nothing "No Predictions Returned". Something either intermittent, or corrupt after first use?
I have seen this happen on older GPUs, I am not sure what is happening. I think I still have an old P400 GPU that I can run some test so hopefully I can fix it. I will not be able to the tests until after next week.
 

truglo

Pulling my weight
Joined
Jun 28, 2017
Messages
275
Reaction score
103
Awesome Mike, and no rush or worries about getting any testing done. Whenever you manage to get around to it is fine. My PC is relatively new, but perhaps I cheaped out a bit on it. The psu won't really be able to handle more than a p400.
 

djmadfx

Getting the hang of it
Joined
Sep 29, 2014
Messages
106
Reaction score
19
I've been trying to troubleshoot alpr not returning plate numbers for a few weeks now... since I first attempted to upgrade from CPAI 2.1.9 to 2.1.11. I initially had issues installing the update, but got those sorted. Some things I've tried... deleting all CPAI folders and reinstalling CPAI 1.1.11, updating CUDA to 11.8 (I was using 11.7 successful before), and running the latest cudnn batch file. CPAI OCR apparently is not returning as expected. So of course I can't expect BI to return OCR either. Any help is much appreciated. I think I got all the relevant screen grabs to convey details of my setup, but let me know if additional info might help.

View attachment 172531
View attachment 172532
View attachment 172533
View attachment 172534

FWIW, AI is otherwise working great with BI. I'm getting accurate alerts for people, packages, deliveries, cars, etc... just the alpr ocr function seems broken on my instance. Any advice to help get it working again is very much appreciated.
I noticed this issue after upgrading from Windows version 2.0.8 of CPAI. The only reason I upgraded was for the Coral TPU functionality. I haven't tried downgrading back to 2.0.8 myself, but I have been having the same ALPR issue as you for a few weeks without any other changes to my setup.
 

dforesi

n3wb
Joined
Sep 18, 2023
Messages
7
Reaction score
0
Location
USA
Hi all, I am trying to get up and running with the ALPR module in Blue Iris and have been having many problems.

When I run the CodeProject Server using the windows installer, the ALPR module always fails to install correctly. It appears that python fails to install.

I then attempted to install the code project server in docker and I am able to get the ALPR module to install, but I receive the following error when I try to start the module

16:35:03:ALPR_adapter.py: Traceback (most recent call last):
16:35:03:ALPR_adapter.py: File "/app/modules/ALPR/ALPR_adapter.py", line 8, in
16:35:03:ALPR_adapter.py: from module_runner import ModuleRunner
16:35:03:ALPR_adapter.py: File "/app/modules/ALPR/../../SDK/Python/module_runner.py", line 28, in
16:35:03:ALPR_adapter.py: import aiohttp
16:35:03:ALPR_adapter.py: ModuleNotFoundError: No module named 'aiohttp'

Additionally, in Blue Iris, the option for ALPR is grayed out.

Has anyone experienced any of these challenges before?

Running the newest version of BI and 2.2beta for CP AI
 

Attachments

dforesi

n3wb
Joined
Sep 18, 2023
Messages
7
Reaction score
0
Location
USA
Well,

For the purposes of closing the loop, I was able to fix it, but I'm not sure how.

I launched a docker instance of CP in an AWS Ubuntu instance. Then exposed the correct ports and pointed BI at the CP container. Again, it didn't allow me to enable ANPR, but after messing around with it, the ANPR check box magically became available. I do not know what changed.

The system appears to be working, the only odd thing is that many of the detections do show up with a plate number, but you can only see this by looking in AI analysis. It seems like if the plate recognition doesn't happen at time 0s then it won't end up in the alerts.
 

djmadfx

Getting the hang of it
Joined
Sep 29, 2014
Messages
106
Reaction score
19
Well,

For the purposes of closing the loop, I was able to fix it, but I'm not sure how.

I launched a docker instance of CP in an AWS Ubuntu instance. Then exposed the correct ports and pointed BI at the CP container. Again, it didn't allow me to enable ANPR, but after messing around with it, the ANPR check box magically became available. I do not know what changed.

The system appears to be working, the only odd thing is that many of the detections do show up with a plate number, but you can only see this by looking in AI analysis. It seems like if the plate recognition doesn't happen at time 0s then it won't end up in the alerts.
Are the plates showing up if you test using the CPAI Explorer?
 

dforesi

n3wb
Joined
Sep 18, 2023
Messages
7
Reaction score
0
Location
USA
CPAI Explorer work just fine. The plate detections are making it back to Blue Iris. There are essentially two problems:
1. Blue Iris not feeding detections to the CP server for long enough
2. If the detection happens from the CP server too long after the trigger, it is not recognized by BI.

1. See attachment 1.The car is detected and is moving forward towards the gate, but BI cancels the alert before the system can see the plate of the vehicle and run the DayPlate / NightPlate detection.
Attach1.png

You would think that by forcing BI to analyze more "real time images" in the AI trigger, you would resolve this problem, however, this is where problem 2 occurs:

2. A plate is detected and transcribed, but it happens too far after the inital trigger, and thus BI does not acknowledge it.
In attachment 2, at T+0msec a DayPlate is recognized with a 69% confidence, but is not transcribed.
Attach2.png

Later in attachment 3 at T+600msec a DayPlate is detected at 99% confidence, and transcribed, but in the BI alert it simply states "DayPlate" and the plate number is not searchable.
Attach3.png
Does anyone have any thoughts on how to solve these behaviors?

Thank you
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,655
Reaction score
50,073
Location
USA
CPAI Explorer work just fine. The plate detections are making it back to Blue Iris. There are essentially two problems:
1. Blue Iris not feeding detections to the CP server for long enough
2. If the detection happens from the CP server too long after the trigger, it is not recognized by BI.

1. See attachment 1.The car is detected and is moving forward towards the gate, but BI cancels the alert before the system can see the plate of the vehicle and run the DayPlate / NightPlate detection.
View attachment 172737

You would think that by forcing BI to analyze more "real time images" in the AI trigger, you would resolve this problem, however, this is where problem 2 occurs:

2. A plate is detected and transcribed, but it happens too far after the inital trigger, and thus BI does not acknowledge it.
In attachment 2, at T+0msec a DayPlate is recognized with a 69% confidence, but is not transcribed.
View attachment 172736

Later in attachment 3 at T+600msec a DayPlate is detected at 99% confidence, and transcribed, but in the BI alert it simply states "DayPlate" and the plate number is not searchable.
View attachment 172735
Does anyone have any thoughts on how to solve these behaviors?

Thank you
Is the entire field of view the trigger?

It looks to me like you need to define some motion zones and increase the motion make time so that the vehicle has enough time to get into the field of view, especially if they are having to stop at that gate every time.
 

dforesi

n3wb
Joined
Sep 18, 2023
Messages
7
Reaction score
0
Location
USA
Correct me if I am wrong, but motion make time is the amount of time required before it triggers the alert. Correct?
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,655
Reaction score
50,073
Location
USA
Correct me if I am wrong, but motion make time is the amount of time required before it triggers the alert. Correct?
That is correct. So if every vehicle has to stop or go slow thru that opening, a make time of 2 seconds would keep it from triggering so early and maybe the entire vehicle is the the frame by then.
 

dforesi

n3wb
Joined
Sep 18, 2023
Messages
7
Reaction score
0
Location
USA
That's what I thought, the challenge there is when the gate is open from a previous vehicle entering. In this case any future cars would not need to slow down and the make time may not be exceeded.

What I don't understand is when I have the system set to analyze 50 real time images at a spacing of 200msec, for 10s of total detection. Why does Blue Iris not honor the detections for a plate when they are made 5 or 6 seconds into the detection window? I can analyze the AI event and see that it was able to transcribe the plate, but that confirmation is not included in the alerts.
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,655
Reaction score
50,073
Location
USA
That's what I thought, the challenge there is when the gate is open from a previous vehicle entering. In this case any future cars would not need to slow down and the make time may not be exceeded.

What I don't understand is when I have the system set to analyze 50 real time images at a spacing of 200msec, for 10s of total detection. Why does Blue Iris not honor the detections for a plate when they are made 5 or 6 seconds into the detection window? I can analyze the AI event and see that it was able to transcribe the plate, but that confirmation is not included in the alerts.
Did you put something in the To Cancel box that you wouldn't see like a giraffe so that if forces it to analyze every additional real time image?
 

dforesi

n3wb
Joined
Sep 18, 2023
Messages
7
Reaction score
0
Location
USA
Did you put something in the To Cancel box that you wouldn't see like a giraffe so that if forces it to analyze every additional real time image?
I did not. I suppose that strategy makes sense. Ie. once it sees a dayplate or nightplate it would theoretically stop analyzing, which would explain the behavior I am seeing. The weird thing is, it continues to send the images to CP for analysis.

I think I will try something like that as you suggest, and then move the detection threshold higher, it seems that capturing a day plate with only 70% certainty often results in a frame too poor to perform OCR.
 

actran

Getting comfortable
Joined
May 8, 2016
Messages
818
Reaction score
749
@dforesi Your AI analysis screen indicates you're doing default object detection as well as ALPR, doing both can put unneccessary load on CP.AI. If the primary focus is ALPR, then turn off the default object detection.

BTW your AI settings are a bit dated if you are trying to get license plates.

Assuming you are using a recent BI5 release, you should really try these configs from MikeLud1 who is the guy behind ALPR: Blue Iris and CodeProject.AI ALPR
 
Last edited:

djmadfx

Getting the hang of it
Joined
Sep 29, 2014
Messages
106
Reaction score
19
Just wanted to post an update. I got ALPR working with the following:

-----
License Plate Reader - Version 2.6 - CPU mode (GPU doesn't work, but used to at one point)
Object Detection (YOLOv5 .NET) - Version 1.6 - GPU (DirectML)
-----

CPAI Explorer returns "No predictions returned", but Blue Iris works without any issue.

I would consider this a workaround for the time being. Ideally I would prefer to use my GPU.
 

dforesi

n3wb
Joined
Sep 18, 2023
Messages
7
Reaction score
0
Location
USA
@dforesi Your AI analysis screen indicates you're doing default object detection as well as ALPR, doing both can put unneccessary load on CP.AI. If the primary focus is ALPR, then turn off the default object detection.

BTW your AI settings are a bit dated if you are trying to get license plates.

Assuming you are using a recent BI5 release, you should really try these configs from MikeLud1 who is the guy behind ALPR: Blue Iris and CodeProject.AI ALPR
Thank you for the advice! I will try turning the object detection off and referencing Mike's settings.
 
Top