CodeProject LPR not detecting car because pre-trigger frames don't seem to exist.

Tygunn

Getting comfortable
Joined
Dec 24, 2016
Messages
398
Reaction score
313
I'm using CodeProject LPR and I'm having some issues reliably capturing plates. The illustration below shows what I think is the problem.

Here's an analysis of one of the AI DAT files:
The car moves from right to left; as you can see, at T=0msec, the bumper of the car is just barely in frame.
1713321940800.png

If I click on any of the images BEFORE T=0, ie T-800msec, the same frame from t=0msec seems to be used and hence there is no valid detection of plates:
1713322041714.png
The same applies to post-trigger frames; they seem to be relatively static. In all cases when the image is repeated, the analysis bounding boxes are the same, so it does look like the AI got the same image.

I can scrub through the results in the trigger preview with AI analysis turned on and it seems to work.

Curious if anyone has run into this before?
 

actran

Getting comfortable
Joined
May 8, 2016
Messages
806
Reaction score
732
@Tygunn If the goal is to do ALPR, then 1st, turn off default object detection by including
objects:0
in the custom models config. You have it enabled above, which adds unnecessary CP.AI load, and it's detecting "car" which has no part in ALPR plate extraction.

Your CP.AI response times of 700-1200ms is not ideal either.

Also, show a screenshot of a car license plate in view to see why license-plate model is not detecting the plate.

Lastly, it's best to use MikeLud1 suggested cam AI configs, your current configs do not match his. He's shared his configs many times on this site.
 
Last edited:

Tygunn

Getting comfortable
Joined
Dec 24, 2016
Messages
398
Reaction score
313
@Tygunn If the goal is to do ALPR, then 1st, turn off default object detection by including in the custom models config. You have it enabled above, which adds unnecessary CP.AI load, and it's detecting "car" which has no part in ALPR plate extraction.
Your CP.AI response times of 700-1200ms is not ideal either.
Also, show a screenshot of a car license plate in view to see why license-plate model is not detecting the plate.
Lastly, it's best to use MikeLud1 suggested cam AI configs, your current configs do not match his. He's shared his configs repeatedly in this thread.
Hello, thanks for the response.

As for the slow CP.AI response time, I do have an issue in my particular configuration right now; YOLO object detection leverages the GPU just fine but license plate detection crashes when the GPU is used. So for the moment LPR is CPU only.

The plates do get detected quite well when the plate is in view; I'll update later with an example analysis where the analysis did work; these are typically when the car was driving slow enough. The problem I'm seeing here is that at the trigger time, cars are typically already heading off frame, meaning the front license plate is already off frame. The pre/post frames don't seem to be working properly. I'll have to double check that the FPS/IFrame settings on the camera are set correctly -- perhaps BI can't decode intermediary frames and hence why I'm seeing the same frames sent to CP.AI for processing.

I'll read through MikeLud1's suggested AI configs and see if that improves things though, thanks.
 

actran

Getting comfortable
Joined
May 8, 2016
Messages
806
Reaction score
732
IMO, your CP.AI response times may impede your ability to grab plate # before the plate is out of view---assuming you have your cam shutter configured appropriately for LPR. (There are a number of good threads on cam configs for LPR.)

1 data point, ALPR is working with an Nvidia 1650 card on my side.
 
Last edited:

Tygunn

Getting comfortable
Joined
Dec 24, 2016
Messages
398
Reaction score
313
If it's not clear, your CP.AI response times does impede your ability to grab plate # before the plate is out of view.
AH HA!!! THANK YOU! No it wasn't clear to me at that the CP.AI response times would have any impact on the ability to grab a plate # before the plate is out of view.

However, reading the manual I do see the following very relevant writeup and diagram:
1713374571541.png
1713374612971.png

My mental model for this was that as soon as the alert triggered, BI would cache the X pre-trigger images and Y pre-trigger images, and then iterate those through CP.AI.

I'll look at tuning my CP.AI setup to optimize this. I'll bet this will solve all the problems.
 

Tygunn

Getting comfortable
Joined
Dec 24, 2016
Messages
398
Reaction score
313
IMO, your CP.AI response times may impede your ability to grab plate # before the plate is out of view---assuming you have your cam shutter configured appropriately for LPR. (There are a number of good threads on cam configs for LPR.)

1 data point, ALPR is working with an Nvidia 1650 card on my side.
I did some more investigation and got it dialed in much better. Removing object detection so I wasn't doing the license-plates model AS well as ALPR seemed to help. I also noticed that my camera was set to H.265. Setting it to H.264 resulted in stable frame grabs with nothing missing.

1713407166051.png

I must have a driver issue for the license plate module; I am forced to leave it in CPU only mode..

1713407350132.png
Otherwise it crashes. I'll have to do some more experimentation with that and see if I can figure it out.

However, I have got things working quite stably now. I'm reliably getting plates captured.
1713407480734.png
 

Tygunn

Getting comfortable
Joined
Dec 24, 2016
Messages
398
Reaction score
313
I realized I didn't have the CUDA 11.8 drivers/toolkit installed. So I did that; and the GPU does get used:
1713410649181.jpeg

However, the AI sure is hallucinating..

{
"api":"alpr",
"found":{
"success":true,
"processMs":882,
"inferenceMs":840,
"predictions":[
{
"confidence":7.60884598196126e+22,
"label":"Plate: f 9V 9P 0hXJ9Rm4hjYN F 2UVXn 3 hbuCV7g Rfq7 Xbz6 rWm S lr 7 DH l lQ zy F x 5dw x5 Blf Q h0l5F K wGYtf G S 5 ",
"plate":"f 9V 9P 0hXJ9Rm4hjYN F 2UVXn 3 hbuCV7g Rfq7 Xbz6 rWm S lr 7 DH l lQ zy F x 5dw x5 Blf Q h0l5F K wGYtf G S 5 ",
"x_min":573,
"y_min":392,
"x_max":755,
"y_max":517}
]
,
"message":"Found Plate: f 9V 9P 0hXJ9Rm4hjYN F 2UVXn 3 hbuCV7g Rfq7 Xbz6 rWm S lr 7 DH l lQ zy F x 5dw x5 Blf Q h0l5F K wGYtf G S 5 ",
"moduleId":"ALPR",
"moduleName":"License Plate Reader",
"code":200,
"command":"alpr",
"requestId":"ff9b2eb0-83a6-4964-92fb-9935ab3aa6a2",
"inferenceDevice":"GPU",
"analysisRoundTripMs":1198,
"processedBy":"localhost",
"timestampUTC":"Thu,
18 Apr 2024 03:20:59 GMT"}
}

I will switch back to CPU for now. Those plate numbers aren't very helpfu. Hahahaha.
 
Top