!! traincascade: So many people run in this issue: Train dataset for temp stage can not be filled
I spent so many hours on this problem. Searching the openCV forum for solutions and also searching in stackoverflow and google. I tried all advices to fix this issue: "Train dataset for temp stage can not be filled.."
Some posts said that we have to use full paths in the negative.txt file rather than relative paths. Others said: That one has to take care that no \r or \n are supposed to be present in the negative.txt file (if you are working on windows). Or: Chaning parameters such as: -minHitRate and -maxFalseAlarmRate will help. Or: Increase amount of posiitives (or negatives)...I tried with 100, 200,...1000, 2000....... etc.....
I tried everything ! why does this program not provide a more informative error msg and why is there no general help for all many many users that run in this issue and wasting so many hours ?
I may help you about this issue, but let me know what stage did you see that message? and what platform are you using? window or linux? what opencv version are you using?
Hello Tim. I am working with windows OS and latest openCv version 2.4.13 (windows x64 ). Ususally training breaks on 2nd or 3rd stage. The object that I want to detect is very simple, it is basically only a shape. I assume that the features that are found are not related to the boundaries of this shape, it looks like the extracted features are related to regions inside the shape of concern. I want to detect objects of similar shapes.
This is the cmd:
Changing parameters such as numPos or numNeg or maxFalseAlarmRate may help to reach 1 stage more but it will never go further than stage 3
As my experience, I would like you to change some points below
hope this help. Tim
dont use LBP, as to my test, I have tested for 20 stages, but the 19th stage had been failed, version 2.4.x not use LBP, I recommend you not to use this option, otherwise your work will not be valuable
-_- seriously these kind of replies make no sense at all. The reason you did not get it to work is because you did something wrong. I am doing a PhD and each and every detector I make is with LBP features and works just fine ...
Hi Steven, are you sure LBP works fine on version 2.4.13? have you taken a look at the code of trancascade?
Actually I am ... just confirmed...
Believe me ,LBP option will not work on version 2.4.13, I have debugged that option.
@Tim Pham, seriously ... i have been using LBP features and traincascade since 2.1 and have not had a single issue with it. So believe me if I say you must be doing something wrong, just like all the other people in this forum who had issues with it.
@Tim I don't think it's related with relative or full pathes since it the process is starting and working for some hours. It just stops at 3rd stage (Train dataset for temp stage can not be filled..). Same effect for HAAR (instead of LBP) @steven: Sure "we" are doing somewhere a mistake, that's why I am searching here for help. Probably the pos images are not "good" enough, I have a very simple shape in a 30x90 pixels image. Shape is white and background is black (Cannot improve this). Then I create samples according to:
I make 8 more vecs and merge them into 1 single vec. What can go wrong ?
OK, Marcello, I have just pointed out some of my work experience that helped me get rid of the error, but I think my situation differs from you. it maybe your posNum and negNum are not good enough. yesterday, I have run full of 20 stages successfully. with 360 pos images and 900 neg images.
Hi @steven, do you think the changing image width and height when create vector affect to detect result? as your mention earlier, size 80x80 is quite big. but my object window size is 80x80, does 20x20 size meet my requirement? Regarding to this LBP option, did you use -baseFormatSave option along with LBP?
and YES, @steven, you are right, LBP works just fine without -baseFormatSave.
@marcello, I appreciated about your "we", may I join to that ? lol
What are the requirements of the neg images? Mine are 240x400, in color, I have created them by saving (each 10th) frame from a movie, thus they differ but some of them are very similar. Can this be a problem ? Should they be gray scaled ? what is recommended ratio compared to the pos images?
I have read some post in this forum, the negative image sizes are free to collect. you can take them randomly.
Let me wrap some things up, because we have 2 separate discussions here
-baseFormatSave
is a really bad choice, it is purely there for backwards compatibility reasons and transforms your model into some ancient OpenCV1.x version of the models ...(1 of 5)
Sorry for the ugly presentation.. This time i reached stage 5. however mostly it stops at stage 4-5 (with identical params) and usually it stops with "Train dataset for temp stage can not be filled"
Thank @StevenPuttemans for your kind answer, indeed, you're really a senior .
I have another question. Do you think that 20 training stages are effective enough for an object detection? suppose, we have enough positive images and negative images (2000 and 5000), if we train for more than 20 stages, for example 36 stages , traincascade result will make more sense. Am I right?
@marcello, why did you changed -maxFalseAlarmRate value?, it may be the cause of error, set the value to 0.5 and see how it goes..