createsample success, but traincascade said 'Can not get new positive sample'

asked 2017-03-08 23:54:16 -0500

hello all, i want to asking some question about opencv using terminal i make some sample using 'opencv_createsamples' with this code above. (bgr3000.txt contains 3000 and more negative mages)

> PC:/media/pandailing/Local Disk/PYTHON_OPENCV_VIDEO/script$ opencv_createsamples -img 1.JPG -bg bgr3000.txt -info info/info.lst -maxxangle 1 -maxyangle 1 -maxzangle 1 -num 1500

and i get this output at my terminal:

Info file name: info/info.lst

Img file name: 1.JPG

Vec file name: (NULL)

BG file name: bgr3000.txt

Num: 1500

BG color: 0

BG threshold: 80

Invert: FALSE

Max intensity deviation: 40

Max x angle: 1

Max y angle: 1

Max z angle: 1

Show samples: FALSE

Width: 24

Height: 24

Create test samples from single image applying distortions...

Done

and then, i continue to make my vector file using the code above

 -PC:/media/pandailing/Local Disk/PYTHON_OPENCV_VIDEO/script$ opencv_createsamples -info info/info.lst -num 1500 -w 20 -h 20 -vec pos.vec

and get this output:

Info file name: info/info.lst

Img file name: (NULL)

Vec file name: pos.vec

BG file name: (NULL)

Num: 1500

BG color: 0

BG threshold: 80

Invert: FALSE

Max intensity deviation: 40

Max x angle: 1.1

Max y angle: 1.1

Max z angle: 0.5

Show samples: FALSE

Width: 20

Height: 20

Create training samples from images collection...

Done. Created 1500 samples

but when i try to traincascade using this script:

PC:/media/pandailing/Local Disk/PYTHON_OPENCV_VIDEO/script$ opencv_traincascade -data data -vec pos.vec -bg bgr3000.txt -numpos 1000 -numneg 800 -numStages 10 -w 20 -h 20

i got this error

PARAMETERS:

cascadeDirName: data

vecFileName: pos.vec

bgFileName: bgr3000.txt

numPos: 2000

numNeg: 1000

numStages: 10

precalcValBufSize[Mb] : 256

precalcIdxBufSize[Mb] : 256

stageType: BOOST

featureType: HAAR

sampleWidth: 20

sampleHeight: 20

boostType: GAB

minHitRate: 0.995

maxFalseAlarmRate: 0.5

weightTrimRate: 0.95

maxDepth: 1

maxWeakCount: 100

mode: BASIC

===== TRAINING 0-stage =====

<begin< p="">

POS current samples: OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file. ) in get, file /build/buildd/opencv-2.4.8+dfsg1/apps/traincascade/imagestorage.cpp, line 162 terminate called after throwing an instance of 'cv::Exception'

what(): /build/buildd/opencv-2.4.8+dfsg1/apps/traincascade/imagestorage.cpp:162: error: (-5) Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file. in function get

what is wrong with my code? please help

edit retag flag offensive close merge delete

Comments

most probably your info file did not contain enough (or any) samples

berak gravatar imageberak ( 2017-03-09 03:16:53 -0500 )edit

i have got the same problem, it always stuck at stage 1 giving the same error.. i have 2000 neg 1000 positive images, :(

ainysiddiqui gravatar imageainysiddiqui ( 2017-03-09 03:32:21 -0500 )edit