Ask Your Question

Getting Error "Image reader can not be created from -vec vector.vec and -bg bkg.dat"

asked 2013-07-18 05:30:01 -0600

Anshul gravatar image

I was trying to train cascade using opencv_traincascade binary, I am using linux 3.7, I threw the below command,

opencv_traincascade -data imgs/cascade/ -numPos 200 -numNeg 8 -numStages 10 -featureType LBP -maxFalseAlarmRate 0.9 -w 640 -h 480 -vec imgs/vector.vec -bg negatve.dat

but it is giving me error "Image reader can not be created from -vec imgs/vector.vec and -bg negatve.dat."

edit retag flag offensive close merge delete


what should be width and height while training cascade.

Anshul gravatar imageAnshul ( 2013-07-18 06:40:11 -0600 )edit

Ok I will try 64x48, just now i am working with 24x24, 640x480 was some random number My Assumption that why we are taking small size is, that we can recognize the image even at that small size so why to take large size image when they will fill ur ram.

I solved the error "Image reader can not be created from -vec vector.vec and -bg bkg.dat" it was because of silly typo i spelled the negative.dat as negatve.dat" sorry for posting silly error but that error gave me no hint that file does not exist or some ting like that

Anshul gravatar imageAnshul ( 2013-07-19 04:34:22 -0600 )edit

Btw, if your problem is solved, please give a shout, I will add my comments as an answer and then you can accept them.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-19 06:32:16 -0600 )edit

Don't mind :) I know that happens to the most of people who have problems with the traincascade algorithm.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-19 06:35:12 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-07-19 06:39:24 -0600

--> Grouped comments into an answer so topic can be indicated solved.

This means that either your negatives are uncorrectly documented in the dat file, to solve this look here or that you have create a wrong vec file. Also, using -w and -h parameters with those sizes will lead to memory allocation problems. Since the complete pyramid is stored in memory, this will cause your software/pc to crash, since RAM will run out and swap will get gigantic :)

Think about the range of 15-15 to like 50-50, which will already increase time multiple times comparing one to the other. It doesn't have to be a square model however, but I suggest downscaling your images to 64*48.

edit flag offensive delete link more

Question Tools


Asked: 2013-07-18 05:30:01 -0600

Seen: 5,299 times

Last updated: Jul 19 '13