opencv_traincascade message: Premature end of JPEG file.

asked 2014-01-18 11:33:16 -0600

SpiderGears gravatar image

updated 2014-01-18 11:34:42 -0600

Following the instruction form the blog on opencv_traincascade... Coding-Robin. At Stage 9 of training i am this message

Premature end of JPEG file

What is it about?

Here is the command

opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000 -numNeg 600 -w 60 -h 60 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024 -featureType LBP

edit retag flag offensive close merge delete

Comments

It can have different reasons... what is your platform? Are you sure there are no corrupt JPEG files in your training data? ... it is basically a problem with JPEG compression and not with the traincascade functionality.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-23 07:15:24 -0600 )edit

Also look at the problem posted here, depending on your system, this could also be the case ...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-23 07:16:57 -0600 )edit

we have tried training on Ubuntu 12.10, 13.10 and Fedora 19. Got same message on all systems though at different stages of training. The message does not stop the training itself... Training continues but now consuming much less cpu resources than before (earlier it was using 100% of all my 4 cpus, after this jpeg msg it came down to 90% of just one cpu.. other cpus were left idle.)

I don't things any of the images are corrupt since training i do not get any such errors in early stages of training (all went fine up till stage 10 for me on Fedora machine..).

I am using opencv 2.4.7 downloaded form Sourceforge.net

SpiderGears gravatar imageSpiderGears ( 2014-01-24 04:22:27 -0600 )edit

remove jpeg support... i don't think it the solution or even right approach to this. this should have smthing to do with the parameters to traincascade though i am not able to figure out the exact thing.

SpiderGears gravatar imageSpiderGears ( 2014-01-24 04:24:25 -0600 )edit

Ok let me express again, this has to do with the underlying JPEG library, not with how traincascade processes data. There isn't a single JPEG error capture in the actual traincascade or cascade detector source code... Somewhere along the way, it tries to grab a positive or negative window, and that window is corrupt, google some more on the error with openCV info and you will see that corrupt jpeg images are widely the cause of this. Also, just as an experience, using jpeg is never a good idea, compression corrupts many algorithms and introduces artefacts. Go for tiff or non compressed png or so.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-24 04:33:11 -0600 )edit