bibnumber icon indicating copy to clipboard operation
bibnumber copied to clipboard

more exemples ?

Open smolleyes opened this issue 8 years ago • 36 comments

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 avatar Mar 12 '16 18:03 smolleyes

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 ?

smolleyes avatar Mar 12 '16 19:03 smolleyes

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.

gheinrich avatar Mar 14 '16 08:03 gheinrich

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 https://github.com/gheinrich/bibnumber/issues/2#issuecomment-196207935.

smolleyes avatar Mar 14 '16 08:03 smolleyes

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 <https://github.com/gheinrich/bibnumber/issues/2#issuecomment-196207935 .

— Reply to this email directly or view it on GitHub https://github.com/gheinrich/bibnumber/issues/2#issuecomment-196208320.

gheinrich avatar Mar 14 '16 08:03 gheinrich

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

<https://github.com/gheinrich/bibnumber/issues/2#issuecomment-196207935 .

— Reply to this email directly or view it on GitHub

https://github.com/gheinrich/bibnumber/issues/2#issuecomment-196208320.

— Reply to this email directly or view it on GitHub https://github.com/gheinrich/bibnumber/issues/2#issuecomment-196209228.

smolleyes avatar Mar 14 '16 09:03 smolleyes

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

smolleyes avatar Mar 14 '16 09:03 smolleyes

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.

gheinrich avatar Mar 14 '16 10:03 gheinrich

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 avatar Mar 14 '16 13:03 smolleyes

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 avatar Mar 14 '16 14:03 smolleyes

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 avatar Mar 14 '16 14:03 smolleyes

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)

smolleyes avatar Mar 14 '16 15:03 smolleyes

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.

gheinrich avatar Mar 15 '16 15:03 gheinrich

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

barne73 avatar Jun 29 '16 14:06 barne73

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.

gheinrich avatar Jun 29 '16 20:06 gheinrich

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

barne73 avatar Jun 30 '16 11:06 barne73

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).

gheinrich avatar Jun 30 '16 12:06 gheinrich

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

smolleyes avatar Jun 30 '16 13:06 smolleyes

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 avatar Jun 30 '16 14:06 smolleyes

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 avatar Jun 30 '16 14:06 smolleyes

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 avatar Jun 30 '16 16:06 smolleyes

image

one of the image with a 1

smolleyes avatar Jun 30 '16 16:06 smolleyes

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 ?

smolleyes avatar Jun 30 '16 17:06 smolleyes

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 avatar Jun 30 '16 20:06 gheinrich

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

make -C bibnumber/Debug

gheinrich avatar Jun 30 '16 20:06 gheinrich

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.

gheinrich avatar Jun 30 '16 20:06 gheinrich

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

smolleyes avatar Jul 01 '16 08:07 smolleyes

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.

gheinrich avatar Jul 01 '16 10:07 gheinrich

@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!

skyviewmedia avatar Aug 14 '16 18:08 skyviewmedia

@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!!!

TrilipuT avatar Oct 11 '16 13:10 TrilipuT

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.

aqe08a avatar Oct 29 '16 17:10 aqe08a