Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more exemples ? #2

Open
smolleyes opened this issue Mar 12, 2016 · 36 comments
Open

more exemples ? #2

smolleyes opened this issue Mar 12, 2016 · 36 comments
Labels

Comments

@smolleyes
Copy link

hi

first, thanks for this project :)

i just builded it on ubuntu 15.10 but when i try a simple

./bibnumber /my/path/*

i have

Processing 2 samples/0009-IMG_0027.JPG
Processing 3 samples/0017-IMG_0035.JPG
Processing 4 samples/0040-IMG_0061.JPG
Processing 5 samples/0056-IMG_0079.JPG
Processing 6 samples/0057-IMG_0080.JPG
Processing 7 samples/0058-IMG_0081.JPG
Processing 8 samples/0059-IMG_0082.JPG
Processing 9 samples/0060-IMG_0083.JPG
Processing 10 samples/0061-IMG_0084.JPG
Processing 11 samples/0062-IMG_0087.JPG
Processing 12 samples/0063-IMG_0088.JPG
Processing 13 samples/0064-IMG_0089.JPG
Processing 14 samples/0065-IMG_0090.JPG
Processing 15 samples/0236-IMG_0273.JPG
Processing 16 samples/0520-IMG_0563.JPG
Processing 17 samples/821-IMG_1297.JPG
ERROR: Could not load classifier cascade

could you add some exemple to get the results you have in the demo ?

2/ with this batch is it possible to get the original image name of the detected bib ?

thanks !

@smolleyes
Copy link
Author

hello

when i add the path of a cascade xml (/usr/share/opencv...) fr me it "works" no errors but it just print me one of the image and that s all ?

@gheinrich
Copy link
Owner

Hello, there are a few examples in the samples folder. You can also use this .csv file to process a number of images for which you know the ground truth. This allows bibnumber to calculate the precision, accuracy and F-Score for you.

You should be able to do:
bibnumber -model samples/svm-prom1.xml samples/ground-truth.csv

Or you could point bibnumber to a directory:
bibnumber <dir>

Or you could point bibnumber to a single image:
bibnumber test.jpg

I hope this helps.

@smolleyes
Copy link
Author

hi

thanks for the reply

will try it asap

could you give me more informations about the ground-truth ?

thanks a lot :)

Le 14/03/2016 09:47, Greg Heinrich a écrit :

Hello, there are a few examples in the samples
https://github.com/gheinrich/bibnumber/tree/master/samples folder.
You can also use this .csv
https://github.com/gheinrich/bibnumber/blob/master/samples/ground-truth.csv
file to process a number of images for which you know the ground
truth. This allows |bibnumber| to calculate the precision, accuracy
and F-Score for you.

You should be able to do:
|bibnumber -model samples/svm-prom1.xml samples/ground-truth.csv|

Or you could point |bibnumber| to a directory:
|bibnumber

|

Or you could point |bibnumber| to a single image:
|bibnumber test.jpg|

I hope this helps.


Reply to this email directly or view it on GitHub
#2 (comment).

@gheinrich
Copy link
Owner

Hi, the ground truth is a list of images. For every image the .csv file
contains the bib numbers that are visible on the image. At the end of
processing the tool uses this to estimate the quality of its results.

On Mon, Mar 14, 2016 at 9:49 AM, smolleyes [email protected] wrote:

hi

thanks for the reply

will try it asap

could you give me more informations about the ground-truth ?

thanks a lot :)

Le 14/03/2016 09:47, Greg Heinrich a écrit :

Hello, there are a few examples in the samples
https://github.com/gheinrich/bibnumber/tree/master/samples folder.
You can also use this .csv
<
https://github.com/gheinrich/bibnumber/blob/master/samples/ground-truth.csv>

file to process a number of images for which you know the ground
truth. This allows |bibnumber| to calculate the precision, accuracy
and F-Score for you.

You should be able to do:
|bibnumber -model samples/svm-prom1.xml samples/ground-truth.csv|

Or you could point |bibnumber| to a directory:
|bibnumber

|

Or you could point |bibnumber| to a single image:
|bibnumber test.jpg|

I hope this helps.


Reply to this email directly or view it on GitHub
<#2 (comment)
.


Reply to this email directly or view it on GitHub
#2 (comment).

@smolleyes
Copy link
Author

hi

i understand :)

last question how can i do the make the software learn and have more
positive results ?

it seems working on some photos when i put them black and white before...

thanks !

Le 14/03/2016 09:53, Greg Heinrich a écrit :

Hi, the ground truth is a list of images. For every image the .csv file
contains the bib numbers that are visible on the image. At the end of
processing the tool uses this to estimate the quality of its results.

On Mon, Mar 14, 2016 at 9:49 AM, smolleyes [email protected]
wrote:

hi

thanks for the reply

will try it asap

could you give me more informations about the ground-truth ?

thanks a lot :)

Le 14/03/2016 09:47, Greg Heinrich a écrit :

Hello, there are a few examples in the samples
https://github.com/gheinrich/bibnumber/tree/master/samples folder.
You can also use this .csv
<

https://github.com/gheinrich/bibnumber/blob/master/samples/ground-truth.csv>

file to process a number of images for which you know the ground
truth. This allows |bibnumber| to calculate the precision, accuracy
and F-Score for you.

You should be able to do:
|bibnumber -model samples/svm-prom1.xml samples/ground-truth.csv|

Or you could point |bibnumber| to a directory:
|bibnumber

|

Or you could point |bibnumber| to a single image:
|bibnumber test.jpg|

I hope this helps.


Reply to this email directly or view it on GitHub

<#2 (comment)
.


Reply to this email directly or view it on GitHub

#2 (comment).


Reply to this email directly or view it on GitHub
#2 (comment).

@smolleyes
Copy link
Author

hello

sorry to bother you

just trying to understand the whole process

so i have a list of 1000 images for exemple

i create a csv file with like 50 images and the bib numbers i know as
the ground truth

then the xml represent the format of the bib to search for ? how do we
create this xml file ?

thanks !

Le 14/03/2016 09:53, Greg Heinrich a écrit :

bibnumber -model samples/svm-prom1.xml samples/ground-truth.csv

@gheinrich
Copy link
Owner

Hi, I tuned the parameters for the images from monaco-athletisme.com. If you're using a different set of images you might have to update some of the parameters. Most critically, the text detection stage is quite sensitive to the scale and contrast of your images. I suggest you read the code to understand more. Also, have a look at this paper.

After you get bibnumber to correctly detect 3-or more-digits bib numbers you can use the -train command-line flag to get bibnumber to learn what a bib looks like (using HOG features and an SVM classifier). This is where the .xml file gets generated. This will allow bibnumber to detect more complicated cases where there are only two digits on the bib.

@smolleyes
Copy link
Author

hi

ok so i imagine that for each set of images i ll have to tune the parameters again ? (if the bib are not the same) ?

i m doing some test with imagemagick for now then will see what you tuned in your code (might be cool to add it as parameters to the bin :p)

thanks!

@smolleyes
Copy link
Author

hello

ok i have some good results by converting my tests images like this first

convert 12.jpg -fuzz 15% -fill 'black' -opaque '#0171fd' -colorspace Gray -contrast -normalize -scale 500 0.jpg

because my bib numbers are cyan color...

just have the numbers detected but rejected by asymetry angle or size :(

Reject 292 on asymmetry

but it s the good bnr

might be cool to have this as parameter ;)

thanks

@smolleyes
Copy link
Author

ok

works well with "classic" black / white bibs but for exemple an image with 1724 and 725 bib it give me 724 and 725 won t detect more or less than 3 digits (with or without your xml and csv exemples)

thanks !

@smolleyes
Copy link
Author

hi

still testing (very interesting!)

so if i want to create a xml i have to create my cvs file with images and corresponding bib numbers first then use the -train parameter if i understand, problem when i use the -train param i have an error

bibnumber -train ../bibnumber/samples/ ../bibnumber/samples/ground-truth.csv
Invalid parameters (not directories as expeceted)

@gheinrich
Copy link
Owner

Some of the text detection parameters can be customized from the TextDetectionParams structure there. If you are able to detect 3-digit bibs, 4-digit bibs should work too. You can inspect what bibnumber "sees" at various stages of text detection by looking at the generated images (canny.png, SWT.png, components.png, text-boxes.png). This usually tells a lot about why a digit may be missing or badly recognized.

The .csv file is only for calculating statistics. It isn't used during learning (i.e. it isn't used during the SVM model learning). To build a new model, just use -train and point the tool to a folder with a large number of samples.

Make good note of this line. During inference this is where we tune parameters depending on whether an SVM model was provided.

@barne73
Copy link

barne73 commented Jun 29, 2016

Hello,

I just started working with bibnumber and I'm very interested to work with this.

Finally I was able to run it. Some difficulties with compil but it was my problem.

I started with some pictures and only one I got the result asymetrics. All the others, I got read [].

I try to train my directory with no success. ERROR: Missing parameter

My command line was ./bibnumber -train /home/android/Downloads/

I also try :

./bibnumber -train /home/android/Downloads/ -model /home/android/Mytest/bibnumber/samples/svm-prom1.xml
ERROR: Missing parameter

This program extracts bib numbers from images.
Usage:
./bibnumber [-train dir] [-model svmModel.xml] image_file|folder_path|csv_ground_truth_file

What's my problem ? I only need couple hints to work by my side.

Kind Regards,

Eric

@gheinrich
Copy link
Owner

Hi @barne73 you need to tell bibnumber where to find your images. For example:

./bibnumber image.jpg

Or:

./bibnumber /path/to/directory/

The train parameter tells bibnumber to learn an SVM model of your bibs. The model parameter tells bibnumber to use a trained SVM model to unlock detections of bibnumbers that have only 2 digits and which are harder to find.

@barne73
Copy link

barne73 commented Jun 30, 2016

Hello,

Thanks for your answer.

Look the result:

**android@builduntu-VM:~/Mytest/bibnumber/bibnumber/Debug$ ./bibnumber /home/android/Downloads/
Processing directory /home/android/Downloads/ into /home/android/Downloads/out.csv

[1/11] Processing file /home/android/Downloads/christian.jpg
Read: []

[2/11] Processing file /home/android/Downloads/heidi.jpg
Read: []

[3/11] Processing file /home/android/Downloads/heidi1.jpg
Read: []

[4/11] Processing file /home/android/Downloads/heidi2.jpg
Read: []

[5/11] Processing file /home/android/Downloads/jeanne.jpg
Read: []

[6/11] Processing file /home/android/Downloads/jonathan.jpg
Read: []

[7/11] Processing file /home/android/Downloads/mathew.jpg
Read: []

[8/11] Processing file /home/android/Downloads/melanie1.jpg
Read: []

[9/11] Processing file /home/android/Downloads/melanie2.jpg
Read: []

[10/11] Processing file /home/android/Downloads/stephane.jpg
Read: []

[11/11] Processing file /home/android/Downloads/william.jpg
index >= 0 && index < size_used_:Error:Assert failed:in file ../ccutil/genericvector.h, line 512
Segmentation fault (core dumped)
**

None of them can find the number I attach an example and it's corresponding to [7/11] Processing file /home/android/Downloads/mathew.jpg

1276595_10152212274217411_4782057213437304076_o

I try to figure out why I can't have any result.

Thanks again for your help

Eric

@gheinrich
Copy link
Owner

You might want to read this. By default bibnumber doesn't show bibs that have two digits or less. Some amount of fine-tuning may be needed (read the previous comments on this thread carefully).

@smolleyes
Copy link
Author

i think doing a small screencast starting from scratch with this module could be a very good thing :p

@smolleyes
Copy link
Author

hello :)

with all my reading on ocr / opencv etc i better understand the process now, just one thing when you tell us t

Some of the text detection parameters can be customized from the TextDetectionParams structure there. If you are able to detect 3-digit bibs, 4-digit bibs should work too

what must me change ? only TextDetectionParams values ?

thanks

@smolleyes
Copy link
Author

smolleyes commented Jun 30, 2016

normal to have

"**/home/greg/ws/**opencv/data/haarcascades/haarcascade_frontalface_alt.xml";

hardcoded in facedetection.cpp ?

replaced it by

/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml

@smolleyes
Copy link
Author

hello

i m more a js dev than c/c++ dev...

i tweak some values of pipeline.cpp then rebuild it each time with

cd bibnumber/Debug/ && g++ -O0 -g3 -pedantic -Wall -Wextra -c -fmessage-length=0 -MMD -MP -MF"pipeline.d" -MT"pipeline.d" -o "pipeline.o" "../pipeline.cpp" && cd ../..

is it right ?

on my test set , 2 images on 6 got results each miss the 1 number (2128 and 2413 normal) and got 228 and 243 :p

@smolleyes
Copy link
Author

image

one of the image with a 1

@smolleyes
Copy link
Author

i continue my tests, now got pretty good results just can t detect the damn 1 ! :p

[1/8] Processing file /home/sylvain/Documents/projets/bibnumber/sampels2/IMG_3930 (Copier) copie.jpg
Read: [ 47]

[2/8] Processing file /home/sylvain/Documents/projets/bibnumber/sampels2/IMG_3981 (Copier) copie.jpg
Read: [ 253]

[3/8] Processing file /home/sylvain/Documents/projets/bibnumber/sampels2/IMG_3991 (Copier) copie.jpg
Read: [ 969 975]

[4/8] Processing file /home/sylvain/Documents/projets/bibnumber/sampels2/IMG_3994 (Copier) copie.jpg
Read: [ 228]

[5/8] Processing file /home/sylvain/Documents/projets/bibnumber/sampels2/IMG_4535 (Copier) copie.jpg
Read: [ 2224]

[6/8] Processing file /home/sylvain/Documents/projets/bibnumber/sampels2/IMG_4813 (Copier) copie.jpg
Read: []

[7/8] Processing file /home/sylvain/Documents/projets/bibnumber/sampels2/IMG_4849 (Copier) copie.jpg
Read: [ 676 707]

[8/8] Processing file /home/sylvain/Documents/projets/bibnumber/sampels2/IMG_5006 (Copier) copie.jpg
Read: [ 225 2482]

what can we tweak for the 1 ?

@gheinrich
Copy link
Owner

normal to have "/home/greg/ws/opencv/data/haarcascades/haarcascade_frontalface_alt.xml" hardcoded in facedetection.cpp ?

Whoops, sorry. This is a remnant of a previous attempt to detect bibs by first detecting faces like in this paper. It turns out that the face detector in OpenCV isn't reliable enough so I decided to not do this.

@gheinrich
Copy link
Owner

@smolleyes why don't you use the makefile as recommended on the readme?

make -C bibnumber/Debug

@gheinrich
Copy link
Owner

what can we tweak for the 1 ?

You need to understand this paper and the code in bibnumber/textdetection.cpp. Then call bibnumber on the failing image and have a look at the various generated .png files.

@smolleyes
Copy link
Author

hello

yeah i rebuild the whole app each time .. no way to add all this values in pipelines.cpp as parameter for bibnumber command line ? faster to test ...

will look at the textdetection.cpp code yep :)

ps: i have very good results on face/eyes detect ith the lastest opencv

@gheinrich
Copy link
Owner

no way to add all this values in pipelines.cpp as parameter for bibnumber command line ?

Feel free to submit a Pull Request.

ps: i have very good results on face/eyes detect ith the lastest opencv

It didn't work too well on the dataset I was using primarily because amateur photos are usually taken from the sides of the running track so faces appear at an angle - runners don't look towards the camera.

@skyviewmedia
Copy link

@gheinrich this is some really great work you have put up!

Although, I am not able to get any results on my image set. I am novice at coding, but can tweak things if you can point me to what exactly will need to be changed.

I am having photographs of runners from various marathon runs.
Sample photo attached. With default settings, it is not able to recognize the number.
img_0006

Also the issue being that in each marathon, the BIBs are designed differently.

Hoping to hear from you.
Thanks!

@TrilipuT
Copy link

@skyviewmedia i have same question, blue/green background and black digits on my numbers.
As far as i checked the code - it makes BW image with white strokes, so should be no problem with colors... But maybe some tweaks needs to be done in min contrast, maybe min size of digit...

@gheinrich could you point what parameter to check in pipeline ?

And thanks for very nice work!!!

@aqe08a
Copy link

aqe08a commented Oct 29, 2016

Hello, I have installed bibnumber on Ubuntu 16. When I call the "train" option I get an error.
I enter:
./bibnumber -train /home/hpsicher/l/ /home/hpsicher/l/

I get:
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/core/src/matrix.cpp, line 323
terminate called after throwing an instance of 'cv::Exception'
what(): /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/core/src/matrix.cpp:323: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

What am I doing wrong ?
Thank you for your help.

@Rudy95
Copy link

Rudy95 commented Apr 21, 2017

hi @smolleyes
I'm wondering if you found the solution for the missing 1 and if you could give me some advice.
I'm also struggling with that and don't know how to fix it.
I've seen that in the generated components.png doesn't see the the number "1" as a component.

Thanks.

@aqe08a
Copy link

aqe08a commented Apr 21, 2017

To be honest: As the owner of this project doesnt seem to bother/answer to any request, I have given up. The "manual way" of putting in bib numbers is far better as a human puts in the numbers and uses his/her brain to compare the previous / next picture to put in the correct number. It is a pity, but it seems that the manual way is the best (fastest and at the same time least error producing way). I have also tried a way with qr codes, but this seems to be complicated as well.

@smolleyes
Copy link
Author

hi

yup same thing i builded a complete tagging system, storing previously entered bib numbers etc, we can works at many people in the same time and it s far better (really boring but better) :)

i close the issue

@steverob
Copy link

@smolleyes do you know how I can make this work with bibs that have numbers in white? Thanks

@xc-racer99
Copy link

@steverob
Totally untested, but in pipeline.cpp, https://github.com/gheinrich/bibnumber/blob/master/bibnumber/pipeline.cpp#L107, there is a parameter labelled "darkOnLight" - you could try switching this to read 0.

@jonaswm
Copy link

jonaswm commented Mar 22, 2018

I receive this error:

root@redes-senac:~/bibnumber/bibnumber/Debug# ./bibnumber -train /root/bibnumber/bibnumber/Debug/Fotos-Teste/ /root/bibnumber/bibnumber/Debug/Fotos-Teste/ Training from positives in /root/bibnumber/bibnumber/Debug/Fotos-Teste/ image data in /root/bibnumber/bibnumber/Debug/Fotos-Teste/
Training from full images in /root/bibnumber/bibnumber/Debug/Fotos-Teste/ image data in /root/bibnumber/bibnumber/Debug/Fotos-Teste/
Opening positive example /root/bibnumber/bibnumber/Debug/Fotos-Teste/teste01.JPG
Opening full image /root/bibnumber/bibnumber/Debug/Fotos-Teste/teste01.JPG
Sampling random patch #1 from [128 x 64 from (421, 806)]
Sampling random patch #2 from [128 x 64 from (1338, 66)]
Sampling random patch #3 from [128 x 64 from (1017, 67)]
Sampling random patch #4 from [128 x 64 from (631, 1270)]
Sampling random patch #5 from [128 x 64 from (1347, 340)]
descriptors :[3780 x 6]
0 dist=0 prediction=1
1 dist=79.1627 prediction=-1
2 dist=35.643 prediction=-1
3 dist=37.1098 prediction=-1
4 dist=38.6149 prediction=-1
5 dist=65.958 prediction=-1
Opening full image /root/bibnumber/bibnumber/Debug/Fotos-Teste/teste01.JPG
Sampling random patch from [128 x 64 from (1221, 1056)]
0 prediction=-1
Opening full image /root/bibnumber/bibnumber/Debug/Fotos-Teste/teste01.JPG
Sampling random patch from [128 x 64 from (71, 37)]
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/core/src/matrix.cpp, line 323
terminate called after throwing an instance of 'cv::Exception'
what(): /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/core/src/matrix.cpp:323: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

Aborted (core dumped)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants