Detect 2 lines plate

2,116 views
Skip to first unread message

Willie

unread,
Apr 27, 2017, 8:09:28 PM4/27/17
to OpenALPR
Dear all,
Did anyone manage to detect 2 lines plate correctly? I have trained using 2 lines Singapore plates but it only detects the second line of the plate only.
How to properly change the [county].conf so that I can detect 2 lines plate correctly?

Many thanks,
Willie 

Willie

unread,
May 1, 2017, 5:22:05 AM5/1/17
to OpenALPR
I attach the 2-lines plate that I am trying to detect. I have also attached the .conf file and .xml file
Can anyone please help me?

Many thanks,
Willie
sg2.xml
sg2.conf
croppedPlate.png

Matt

unread,
May 2, 2017, 6:56:28 AM5/2/17
to OpenALPR
There's an example in runtime_data/config/kr2.conf

The key settings are:

multiline = 1

And setting the char_height_mm and char_width_mm two times.  For example

char_height_mm = 48
char_width_mm = 38
char_height_mm = 48
char_width_mm = 38

Are you able to share your source image data?  

Willie

unread,
May 2, 2017, 11:16:15 PM5/2/17
to OpenALPR
Thanks for the respond, Matt.

Just to clarify, I just realized that my newly trained 2-lines plate detector can not detect the 2-lines plate at all (i.e. by accident I have used the existing 1-line plate detector and that detector was the one that detects the second line).
I have tried to use my newly trained 2-lines model to detect the attached two image data (Singapore plates) with no success.


Can you please assist me further on this.

Many thanks in advance,
Willie
284_1_l.jpg
a8cc3ab8-00cd-11e6-937c-f1bd7dda6b56.jpg

Matt

unread,
May 5, 2017, 2:12:52 PM5/5/17
to OpenALPR
Here's a config file that I tweaked to work for the SGX-7923G plate.  It still got it wrong because the OCR didn't correctly identify the characters, but the multiline detection worked as expected.  I think more work needs to be done on the multiline detection code, since it seems like it gives up a little too easily.

If it's possible to upload the full-sized images you used for training, it would be helpful to improve general support for Singapore.
sg2.conf

Willie

unread,
May 8, 2017, 2:22:06 AM5/8/17
to OpenALPR
Hi Matt, 

Thanks a lot for helping to tweak the config file, I really appreciate it. Now, it can detect multiline (i.e. 2 lines), however, the identified plate numbers that I got from AlprPlateResult.plates[k].topNPlates is not right. Most of the times the 2-lines plate is identified as 3-lines. Can you please advise the weblink to get the full source project files and which part in the project file that I need to concentrate on to fix this issue? 

Unfortunately, I could not get the permission to upload the full-size images that I used for training here.

Many thanks,
Willie

Matt

unread,
May 8, 2017, 12:05:27 PM5/8/17
to OpenALPR
Willie, Can you upload an example?  I don't think 3-line output was ever intended.

Willie

unread,
May 9, 2017, 2:36:22 AM5/9/17
to OpenALPR
Hi Matt,

I have run my below code for the SGX-7923G plate.

Below is a portion of my code:
typedef struct BESTMATCH {
cv::Point2d platePoints[4];
std::string characters;
float confidence;
};
cv::String filename = "a8cc3ab8-00cd-11e6-937c-f1bd7dda6b56.jpg";
alpr::AlprResults results = openalpr.recognize(filename);
for (int i = 0; i < results.plates.size(); i++)
alpr::AlprPlateResult plate = results.plates[i];
std::vector<BESTMATCH> vBestMatch;
for (int k = 0; k < plate.topNPlates.size(); k++)
{
alpr::AlprPlate candidate = plate.topNPlates[k];
BESTMATCH bestMatch;
for (int pt = 0; pt < 4; pt++) {
bestMatch.platePoints[pt].x = plate.plate_points[pt].x;
bestMatch.platePoints[pt].y = plate.plate_points[pt].y;
}
bestMatch.characters = candidate.characters;
bestMatch.confidence = candidate.overall_confidence;
vBestMatch.push_back(bestMatch);
}
        for (int k = 0; k < vBestMatch.size(); k++)
        {
                std::cout << "k=" << k << ": " << vBestMatch[k].characters << " with " << vBestMatch[k].confidence << "% confidence matched\n";
        }
}

And here is the results:
k=0:
79
SG
G with 86.9762% confidence matched
k=1:
9
SG
G with 83.0711% confidence matched
k=2:
79
G
G with 81.409% confidence matched
k=3:
79
9G
G with 75.2037% confidence matched
As you notice from the result, each of the vBestMatch[k].characters comes as 4 lines: 
<Carriage-Return>
<line 1>
<line 2>
<line 3>

Can you enlighten me on how to interpret the detected 2-line plate using OpenAlpr library?

Many thanks in advance,
Willie
Message has been deleted

Joel Vargas

unread,
May 23, 2017, 11:17:37 PM5/23/17
to OpenALPR
I got it working now. 

Oh man, I realized I was using the old binaries and once I used the latest ones, everything went right.

So, Willie, please make sure that you are using the up-to-date binaries :)

Em quarta-feira, 17 de maio de 2017 11:51:56 UTC-3, Joel Vargas escreveu:
Hi Willie and Matt...

I'm facing the same here. The results for the attached frame look like more than two lines are being identified:

plate0: 10 results
    - EHZ-77     confidence: 94.0251
    - E-8-Z-77   confidence: 92.8055
    - EH-677     confidence: 92.6538
    - E-8677     confidence: 91.4342
    - E-B-Z-77   confidence: 83.8432
    - 6HZ-77     confidence: 83.6431
    - EH2-77     confidence: 83.6186
    - EH-S77     confidence: 83.1083
    - E-G-Z-77   confidence: 83.0615
    - EH-B77     confidence: 82.8813 

However, the OCR debug shows correctly every char position by line (see ocrLog.txt).

I can't understand why is this happening. What could be wrong with our configs?

Willie

unread,
May 24, 2017, 2:33:19 AM5/24/17
to OpenALPR
Hi Joel, 
About the latest binaries that you just have used, where can I download them from? I would like to double-check if the one that I downloaded before was the latest ones.
Or did you build them by yourself?

Many thanks,
Willie

Joel Vargas

unread,
May 24, 2017, 8:23:48 AM5/24/17
to OpenALPR
I don't think you could find where to download them since v2.4.0 release has not been deployed. 
That's why I build all here after every new commit.

Willie

unread,
May 25, 2017, 1:30:16 AM5/25/17
to OpenALPR
I see.
How did you find out about the version? For me, I used the built alpr.exe, and at command prompt I type "alpr.exe --version", the result is version 2.3.0.
If I download or clone from https://github.com/openalpr/openalpr, will I get the latest source files?

Many thanks,
Willie

Joel Vargas

unread,
May 25, 2017, 7:54:54 AM5/25/17
to OpenALPR
Matt commented about v2.4.0 here.

As we can see here, the version control has not been updated in the source code (I guess it will be updated at the moment of the next release) and that's why you will get 2.3.0 even if you compile the latest code today.

If I download or clone from https://github.com/openalpr/openalpr, will I get the latest source files?
Yeap, that's the master branch of the OpenALPR repo. 

Francis Teo

unread,
Jul 30, 2017, 9:46:48 PM7/30/17
to OpenALPR
Hi Joel/Matt,

I am new to openalpr and have been reviewing through the forum.
As for the MUlti-line used in SG - can i know what is the status?
Do i need to download the sg2 and overwrite existing config?
Is the binaries 2.4.0 or 2.3.2?
I downloaded the latest release and run alpr -c sg samples/sgcp2.jpg --debug

Attached are the same car with dual line vs single-line.

Appreciate your help.
Here is the debug statement.

sgcp1.jpg
sgcp2.JPG
debug.PNG

指舞如歌

unread,
Jun 27, 2018, 10:45:07 PM6/27/18
to OpenALPR
I managed to make it work with a little bit modification of your sg2.conf and my own sg2.xml. The sg2.xml was generated by training 640 images. But it seems not very stable and accurate. It sometimes give a very accurate result. Sometimes missing certain characters. Worst case it didn't find the license plate or only return second line of license plate. When I can't find the vehicle license plate number, sometimes I zooming or zooming out the image then it can detect.

I'm wondering if it's because the training data not enough? Any guideline on how to train the detector? Thanks.


指舞如歌

unread,
Jun 28, 2018, 12:18:37 AM6/28/18
to OpenALPR


Here are some of my testing result:


1. Working with full image






























plate0: 10 results

    - SJQ-3001U  confidence: 91.7866

    - SJQ-30Q1U  confidence: 90.391

    - SJQ-30D1U  confidence: 87.2609

    - 9JQ-3001U  confidence: 85.5751

    - SJQ-30G1U  confidence: 85.4717

    - SJQ-3Q01U  confidence: 85.0811

    - SJQ-3D01U  confidence: 84.8455

    - SJQ-301U  confidence: 84.21

    - 9JQ-30Q1U  confidence: 84.1795

    - SJQ-30B1U  confidence: 83.8736



2. Not accurate for only plate image



plate0: 10 results

    - SJQ-3U  confidence: 84.6158

    - 6SJQ-3U  confidence: 82.3705

    - SJQ-3DU  confidence: 80.5508

    - SJQ-30U  confidence: 80.5043

    - 6SJQ-3DU  confidence: 78.3055

    - 6SJQ-30U  confidence: 78.2589

    - SJQ-3QU  confidence: 78.1216

    - SJQ-U  confidence: 77.5413

    - 5JQ-3U  confidence: 76.4535

    - 6SJQ-3QU  confidence: 75.8763


3. Not working at all

Please refer to the attachment for the debug info.Any suggestion on how to improve the accuracy? Thanks.





result.txt

blues

unread,
Jun 28, 2018, 5:15:57 AM6/28/18
to OpenALPR
Hi, 
Can you share your sg2.xml, sg2.conf and the original images for test?

指舞如歌於 2018年6月28日星期四 UTC+8下午12時18分37秒寫道:

指舞如歌

unread,
Jun 29, 2018, 3:47:38 AM6/29/18
to OpenALPR
Here are the sg2.conf and sg2.xml. You can use the image in my original post to test.
sg2.conf
sg2.xml

Panhavorn Nguon

unread,
Aug 23, 2018, 7:19:41 AM8/23/18
to OpenALPR
Hi, I try copy sg2.conf and sg2.xml to runtime_data folder. but it still can not work.
Reply all
Reply to author
Forward
0 new messages