Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV_CreateSamples and Training can't read negatives.txt

OS: WIN 64 (German verison) BUILD In 32 around 3229 positives, 3000 negatives, all pos. are 24x24, all neg. are of different, larger resolutions (640x480 and bigger)

It seems it can't open the negatives.txt i created.

positives.txt looks like: ...

./Pos/1006.jpg 1 0 0 24 24

./Pos/1007.jpg 1 0 0 24 24 ...

negatives.txt (=neg.txt) looks like: ...

./negatives/3212.jpg

./negatives/3213.jpg

./negatives/3214.jpg

... also tried it with full path and without the "./" (no difference and it works with the positives). Converting negatives.txt to Ansi or UTF-8 without BOM hasn't helped either.

If i understood it correctly, he should place images randomly into one of the background images i have in my negatives.txt. ./opencv_createsamples -info positives.txt -bg neg.txt -num 1000 -maxidev 100 -vec training.vec -show He only Shows positives

./opencv_createsamples -img ./pos/1015.jpg -bg neg.txt -num 1000 -maxidev 100 -vec test.vec -show (shows nothing) and ./opencv_createsamples -vec test.vec -show crashes with OpenCV Error: Assertion failed (elements_read1 == 1 && elements_read2 == 1 && elements_read3 == 1 && elements_read4 == 1) in cvShowVecSamples, file E:\opencv_src\apps\createsamples\utility.cpp, line 1619

Also i tried to build a training.vec with the negatives just to see if it will show something there. Trying to have a look into it "-show" does not return anything

Creating samples with only positives works flawless but the training will crash with different errors and is way too fast.

/opencv_traincascade -data result -vec training.vec -bg neg.txt -numPos 900 -numNeg 2900 -numStages 4 -precalcValBufSize 2048 -precalcIdxBufSize 2048 -numThreads 3 -featureType LBP -w 24 -h 24 -minHitRate 0.99 -maxFalseAlarmRate 0.5

examples= POS count : consumed 900 : 900 NEG count : acceptanceRatio 2900 : 1 Precalculation time: 1.077

+----+---------+---------+

| N | HR | FA |

+----+---------+---------+

| 1| 1| 1|

+----+---------+---------+

| 2| 0.995556| 0.107586|

+----+---------+---------+

END> Training until now has taken 0 days 0 hours 0 minutes 1 seconds.

===== TRAINING 1-stage ===== <begin pos="" count="" :="" consumed="" 900="" :="" 904="" neg="" count="" :="" acceptanceratio="" 2900="" :="" 0.121905="" precalculation="" time:="" 1.084<="" p="">

+----+---------+---------+

| N | HR | FA |

+----+---------+---------+

| 1| 1| 1|

+----+---------+---------+

| 2| 1| 1|

+----+---------+---------+

| 3| 0.994444| 0.113103|

+----+---------+---------+

END>

Training until now has taken 0 days 0 hours 0 minutes 3 seconds.

POS count : consumed 900 : 910 Train dataset for temp stage can not be filled. Branch training terminated.

When reducing minHitRate to 0.9:

POS count : consumed 300 : 320 NEG count : acceptanceRatio 9 : 0.05625 Required leaf false alarm rate achieved. Branch training terminated.

OpenCV_CreateSamples and Training can't read negatives.txt

OS: WIN 64 (German verison) BUILD In 32 32

around 3229 positives, positives, 3000 negatives, negatives, all pos. are 24x24, 24x24, all neg. are of different, larger resolutions (640x480 and bigger)

It seems it can't open the negatives.txt i created.

positives.txt looks like: ...

like:

./Pos/1006.jpg 1 0 0 24 24

24 ./Pos/1007.jpg 1 0 0 24 24 ...

negatives.txt (=neg.txt) looks like: ...

like:

./negatives/3212.jpg 

./negatives/3213.jpg

./negatives/3214.jpg

... ./negatives/3214.jpg

also tried it with full path and without the "./" (no difference and it works with the positives). Converting negatives.txt to Ansi or UTF-8 without BOM hasn't helped either.

If i understood it correctly, he should place images randomly into one of the background images i have in my negatives.txt. negatives.txt.

./opencv_createsamples -info positives.txt -bg neg.txt -num 1000 -maxidev 100 -vec training.vec -show
He 

only Shows shows positives

./opencv_createsamples -img ./pos/1015.jpg -bg neg.txt -num 1000 -maxidev 100 -vec test.vec -show
(shows nothing)
and
-show

shows nothing and

./opencv_createsamples -vec test.vec -show

crashes with with

OpenCV Error: Assertion failed (elements_read1 == 1 && elements_read2 == 1 && elements_read3 == 1 && elements_read4 == 1) in cvShowVecSamples, file E:\opencv_src\apps\createsamples\utility.cpp, line 1619

1619

Also i tried to build a training.vec with the negatives just to see if it will show something there. Trying to have a look into it "-show" does not return anything

anything. Creating samples with only positives works flawless but the training will crash with different errors and is way too fast.

/opencv_traincascade -data result -vec training.vec -bg neg.txt -numPos 900 -numNeg 2900 -numStages 4 -precalcValBufSize 2048 -precalcIdxBufSize 2048 -numThreads 3 -featureType LBP -w 24 -h 24 -minHitRate 0.99 -maxFalseAlarmRate 0.5

examples= 0.5

Examples

POS count : consumed 900 : 900
NEG count : acceptanceRatio 2900 : 1
Precalculation time: 1.077

+----+---------+---------+

1.077 +----+---------+---------+ | N | HR | FA |

+----+---------+---------+

| +----+---------+---------+ | 1| 1| 1|

+----+---------+---------+

1| +----+---------+---------+ | 2| 0.995556| 0.107586|

+----+---------+---------+

0.107586| +----+---------+---------+ END> Training until now has taken 0 days 0 hours 0 minutes 1 seconds.

seconds. ===== TRAINING 1-stage ===== <begin pos="" count="" :="" consumed="" 900="" :="" 904="" neg="" count="" :="" acceptanceratio="" 2900="" :="" 0.121905="" precalculation="" time:="" 1.084<="" p="">

+----+---------+---------+

<BEGIN POS count : consumed 900 : 904 NEG count : acceptanceRatio 2900 : 0.121905 Precalculation time: 1.084 +----+---------+---------+ | N | HR | FA |

+----+---------+---------+

| +----+---------+---------+ | 1| 1| 1|

+----+---------+---------+

1| +----+---------+---------+ | 2| 1| 1|

+----+---------+---------+

1| +----+---------+---------+ | 3| 0.994444| 0.113103|

+----+---------+---------+

END>

0.113103| +----+---------+---------+ END> Training until now has taken 0 days 0 hours 0 minutes 3 seconds.

seconds. POS count : consumed 900 : 910 Train dataset for temp stage can not be filled. Branch training terminated.

terminated. When reducing minHitRate to 0.9:

0.9: POS count : consumed 300 : 320 NEG count : acceptanceRatio 9 : 0.05625 Required leaf false alarm rate achieved. Branch training terminated.

terminated.