Usage of trained model in OpenAlpr failed

269 views
Skip to first unread message

Ognjen Gojkovic

unread,
Aug 3, 2020, 10:00:06 AM8/3/20
to OpenALPR
Hello,

I am trying to train the model for OpenALPR to detect Serbian license plates. There is already serbian font data in the original repository for training, but it is not meant to recognize latin letter characters like ŠĐĆČŽ which are important on Serbian license plates. 

I have gathered around 2300 pictures for the traning and the preparation for training has gone without any issues. But when i try to run the train.py, this is the console output i get:

Two-Letter Country Code to Train: rs
Processing: ./rs/input/leu.serbia.exp0.box
Executing: /usr/local/bin/tesseract -l eng ./rs/input/leu.serbia.exp0.tif leu.serbia.exp0 nobatch box.train.stderr
Failed loading language 'eng'
Tesseract couldn't load any languages!
Could not initialize tesseract.
mv: cannot stat './leu.serbia.exp0.tr': No such file or directory
mv: cannot stat './leu.serbia.exp0.txt': No such file or directory
Extracting unicharset from box file ./rs/input/leu.serbia.exp0.box
Other case a of A is not in unicharset
Other case b of B is not in unicharset
Other case c of C is not in unicharset
Other case d of D is not in unicharset
Other case e of E is not in unicharset
Other case f of F is not in unicharset
Other case g of G is not in unicharset
Other case h of H is not in unicharset
Other case i of I is not in unicharset
Other case j of J is not in unicharset
Other case k of K is not in unicharset
Other case l of L is not in unicharset
Other case m of M is not in unicharset
Other case n of N is not in unicharset
Other case o of O is not in unicharset
Other case p of P is not in unicharset
Other case r of R is not in unicharset
Other case s of S is not in unicharset
Other case t of T is not in unicharset
Other case u of U is not in unicharset
Other case v of V is not in unicharset
Other case w of W is not in unicharset
Other case x of X is not in unicharset
Other case y of Y is not in unicharset
Other case z of Z is not in unicharset
Other case ć of Ć is not in unicharset
Other case č of Č is not in unicharset
Other case đ of Đ is not in unicharset
Other case š of Š is not in unicharset
Other case ž of Ž is not in unicharset
Wrote unicharset file unicharset
Executing: /usr/bin/mftraining -F ./tmp/font_properties -U unicharset -O ./tmp/lrs.unicharset ./tmp/*.tr
Warning: No shape table file present: shapetable
Reading ./tmp/*.tr ...
Failed to open tr file: ./tmp/*.tr
Flat shape table summary: Number of shapes = 0 max unichars = 0 number with multiple unichars = 0
Warning: no protos/configs for Joined in CreateIntTemplates()
Warning: no protos/configs for |Broken|0|1 in CreateIntTemplates()
Warning: no protos/configs for 0 in CreateIntTemplates()
Warning: no protos/configs for 1 in CreateIntTemplates()
Warning: no protos/configs for 2 in CreateIntTemplates()
Warning: no protos/configs for 3 in CreateIntTemplates()
Warning: no protos/configs for 4 in CreateIntTemplates()
Warning: no protos/configs for 5 in CreateIntTemplates()
Warning: no protos/configs for 6 in CreateIntTemplates()
Warning: no protos/configs for 7 in CreateIntTemplates()
Warning: no protos/configs for 8 in CreateIntTemplates()
Warning: no protos/configs for 9 in CreateIntTemplates()
Warning: no protos/configs for A in CreateIntTemplates()
Warning: no protos/configs for B in CreateIntTemplates()
Warning: no protos/configs for C in CreateIntTemplates()
Warning: no protos/configs for D in CreateIntTemplates()
Warning: no protos/configs for E in CreateIntTemplates()
Warning: no protos/configs for F in CreateIntTemplates()
Warning: no protos/configs for G in CreateIntTemplates()
Warning: no protos/configs for H in CreateIntTemplates()
Warning: no protos/configs for I in CreateIntTemplates()
Warning: no protos/configs for J in CreateIntTemplates()
Warning: no protos/configs for K in CreateIntTemplates()
Warning: no protos/configs for L in CreateIntTemplates()
Warning: no protos/configs for M in CreateIntTemplates()
Warning: no protos/configs for N in CreateIntTemplates()
Warning: no protos/configs for O in CreateIntTemplates()
Warning: no protos/configs for P in CreateIntTemplates()
Warning: no protos/configs for R in CreateIntTemplates()
Warning: no protos/configs for S in CreateIntTemplates()
Warning: no protos/configs for T in CreateIntTemplates()
Warning: no protos/configs for U in CreateIntTemplates()
Warning: no protos/configs for V in CreateIntTemplates()
Warning: no protos/configs for W in CreateIntTemplates()
Warning: no protos/configs for X in CreateIntTemplates()
Warning: no protos/configs for Y in CreateIntTemplates()
Warning: no protos/configs for Z in CreateIntTemplates()
Warning: no protos/configs for Ć in CreateIntTemplates()
Warning: no protos/configs for Č in CreateIntTemplates()
Warning: no protos/configs for Đ in CreateIntTemplates()
Warning: no protos/configs for Š in CreateIntTemplates()
Warning: no protos/configs for Ž in CreateIntTemplates()
Done!
cp: cannot stat './rs/input/unicharambigs': No such file or directory
Reading ./tmp/*.tr ...
TrainingPage:Error:Assert failed:in file cntraining.cpp, line 125
Illegal instruction (core dumped)
mv: cannot stat './normproto': No such file or directory
Combining tessdata files
Output lrs.traineddata created successfully.
Version string:4.1.1
1:unicharset:size=2392, offset=192
3:inttemp:size=221590, offset=2584
4:pffmtable:size=285, offset=224174
13:shapetable:size=4, offset=224459
23:version:size=5, offset=224463
mv: cannot stat './lrs.normproto': No such file or directory
mv: cannot stat './lrs.unicharambigs': No such file or directory


After that, the lrs.traineddata file is generated, and when i try to import it and use it, i get this message from console:

tessdata_manager.SeekToStart(TESSDATA_NORMPROTO):Error:Assert failed:in file adaptmatch.cpp, line 561
fish: “python3 demo.py” terminated by signal SIGSEGV (Address boundary error)


I assume that something went wrong with the training because i followed all the steps exactly after gathering ~25 images of printed letters.


Also, i don't know if there will be a problem with detecting those special letters since the character ticks are above all other letters, and not under other letters as shown or .tif image. ('ve attatched some examples of how letters look on license plates)


Files for training are attached.

If you can train it for me, it would be much appreciated.


lrs.traineddata
leu.serbia.exp0.tif
leu.serbia.exp0.box
1.jpg
7.jpg

Nam Phạm Quang

unread,
Sep 24, 2020, 4:26:12 AM9/24/20
to OpenALPR
Hi  Ognjen Gojkovic,

Did you train lrs.traineddata follow this tutorial?

If true, please show me how did you set some parameters:

TESSERACT_DIR=''"
os.environ["TESSDATA_PREFIX"] = TESSERACT_DIR
TESSERACT_BIN=TESSERACT_DIR + '/tesseract'
TESSERACT_TRAINDIR= TESSERACT_DIR + '/training'

Many thanks.

Vào lúc 21:00:06 UTC+7 ngày Thứ Hai, 3 tháng 8, 2020, Ognjen Gojkovic đã viết:

Ognjen Gojkovic

unread,
Sep 24, 2020, 12:11:48 PM9/24/20
to OpenALPR
Hello, thanks for your response and willingness to help,
Yes, i have trained it that way.

These were my parameters:

TESSERACT_DIR='/usr/share/tesseract-ocr/4.00/tessdata'
os.environ["TESSDATA_PREFIX"] = TESSERACT_DIR
TESSERACT_BIN= '/usr/local/bin/tesseract'
TESSERACT_TRAINDIR= '/usr/bin'

I have precompiled everything and tested, so it is working fine, but seems like there's some problem with training specifically.

Contents of TESSERACT_DIR:
tessdata.png

Nam Phạm Quang

unread,
Sep 28, 2020, 3:53:59 AM9/28/20
to OpenALPR

Hi Ognjen Gojkovic,

Thanks for your help.
I had run my trainning script, but still some problems, I will try to fix it.

Thanks again!

Vào lúc 23:11:48 UTC+7 ngày Thứ Năm, 24 tháng 9, 2020, Ognjen Gojkovic đã viết:

Ognjen Gojkovic

unread,
Sep 28, 2020, 4:17:53 AM9/28/20
to OpenALPR
Thanks, let me know when you do something.

Vladimir Radnovic

unread,
Dec 13, 2020, 10:25:18 AM12/13/20
to OpenALPR
Pozdrav Ognjene
postoji vec istrenirana bibljoteka, koja radi sa nasim slovima, zavisnosti za sta ti treba mozes se javiti na private msg pa cu ti detaljnije objasniti
pozdrav

Ognjen Gojkovic

unread,
Jan 4, 2021, 11:23:45 AM1/4/21
to OpenALPR
Pozdrav Vladimire,
Hvala na interesovanju.
Iz nekog razloga ne mogu da vidim tvoju punu e-mail adresu, pa ako mozes, posalji mi poruku na ognjengo...@gmail.com, da tamo nastavimo.
Reply all
Reply to author
Forward
0 new messages