Error when launch opencv_traincascade : _cascadeDirName or _bgfileName or _vecFileName is NULL

asked 2016-01-18 10:01:16 -0600

Hello, I work with OpenCV on a mac book pro running on version 10.11.2 (15C50)- latest one. I successfully ran the first stage : opencv_createsamples -img FianetLogo.jpg –num 10 -vec Fianet.vec -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 60 -h 20 => OK, vec produced.

but the second stage is KO: opencv_traincascade -data data/ -vec fianet.vec –bg bg.txt -numStages 15 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 5 -numNeg 99 -w 60 -h 20 -mode BASIC -precalcValBufSize 1024 -precalcIdxBufSize 1024.

OpenCV Error: Bad argument (_cascadeDirName or _bgfileName or _vecFileName is NULL) in train, file /Users/dhoop/Desktop/opencv/apps/traincascade/cascadeclassifier.cpp, line 145 libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/dhoop/Desktop/opencv/apps/traincascade/cascadeclassifier.cpp:145: error: (-5) _cascadeDirName or _bgfileName or _vecFileName is NULL in function train

Abort trap: 6

  1. All directory permission have been modified with a chmod +R 777, to avoid right access issues.
  2. It doesn’t work better with an absolute path.
  3. All files are available : ls -all total 4744 drwxrwxrwx 8 dhoop staff 272 17 jan 18:34 . drwxr-xr-x@ 46 dhoop staff 1564 18 jan 16:24 .. -rwxrwxrwx@ 1 dhoop staff 6148 17 jan 18:34 .DS_Store -rwxrwxrwx@ 1 dhoop staff 8666 2 déc 21:48 FianetLogo.jpg -rwxrwxrwx@ 1 dhoop staff 1833 5 déc 13:32 bg.txt drwxrwxrwx 2 dhoop staff 68 17 jan 15:15 data -rwxrwxrwx 1 dhoop staff 2401012 22 déc 21:35 fianet.vec drwxrwxrwx 106 dhoop staff 3604 22 déc 21:21 img

  4. more bg.txt img/negative0.png img/negative1.png ...

  5. Detail of my OpenCV setup: locate dylib | grep cv /Applications/VLC.app/Contents/MacOS/plugins/libcvdsub_plugin.dylib /usr/local/lib/libopencv_calib3d.3.0.0.dylib /usr/local/lib/libopencv_calib3d.3.0.dylib /usr/local/lib/libopencv_calib3d.dylib /usr/local/lib/libopencv_core.3.0.0.dylib /usr/local/lib/libopencv_core.3.0.dylib /usr/local/lib/libopencv_core.dylib /usr/local/lib/libopencv_features2d.3.0.0.dylib /usr/local/lib/libopencv_features2d.3.0.dylib /usr/local/lib/libopencv_features2d.dylib /usr/local/lib/libopencv_flann.3.0.0.dylib /usr/local/lib/libopencv_flann.3.0.dylib /usr/local/lib/libopencv_flann.dylib /usr/local/lib/libopencv_highgui.3.0.0.dylib /usr/local/lib/libopencv_highgui.3.0.dylib /usr/local/lib/libopencv_highgui.dylib /usr/local/lib/libopencv_imgcodecs.3.0.0.dylib /usr/local/lib/libopencv_imgcodecs.3.0.dylib /usr/local/lib/libopencv_imgcodecs.dylib /usr/local/lib/libopencv_imgproc.3.0.0.dylib /usr/local/lib/libopencv_imgproc.3.0.dylib /usr/local/lib/libopencv_imgproc.dylib /usr/local/lib/libopencv_ml.3.0.0.dylib /usr/local/lib/libopencv_ml.3.0.dylib /usr/local/lib/libopencv_ml.dylib /usr/local/lib/libopencv_objdetect.3.0.0.dylib /usr/local/lib/libopencv_objdetect.3.0.dylib /usr/local/lib/libopencv_objdetect.dylib /usr/local/lib/libopencv_photo.3.0.0.dylib /usr/local/lib/libopencv_photo.3.0.dylib /usr/local/lib/libopencv_photo.dylib /usr/local/lib/libopencv_shape.3.0.0.dylib /usr ...

(more)
edit retag flag offensive close merge delete

Comments

So wait, if I read this correctly, the error is only occuring on the second stage of training? So stage 0 and 1 were succesful?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-01-18 11:35:27 -0600 )edit

@StevenPuttemans: he managed to create the .vec file with createsamples (first stage for him), but failed to run the traincascade (his second stage)

LorenaGdL gravatar imageLorenaGdL ( 2016-01-18 14:07:46 -0600 )edit

@Garenne92 you create a Fianet.vec file, but then call a fianet.vec file. Caps matter?

LorenaGdL gravatar imageLorenaGdL ( 2016-01-18 14:09:41 -0600 )edit

I processed again the opencv_createsamples with a small f (fianet.vec) and tried again the opencv_traincascade command which still fail with the same error. It seems caps don’t matter unfortunately.

Garenne92 gravatar imageGarenne92 ( 2016-01-18 15:09:19 -0600 )edit