0

I have been fiddling around with OpenCV's cascade trainer in an attempt to train my own classifier. The problem is that it has been training for 25+hours now and it is yet to even pass stage 1.

Initially, I ran it with the following command

nohup opencv_traincascade -data data -vec board.vec -bg bg.txt -numPos 580 -numNeg 1160 -numStages 2 -w 115 -h 153 -featureType LBP &

After about 24 hours, it wasn't able to get through even stage 1. A look into the nohup.out file, I realized that the default precalcValBufSize was set to 1024Mb. I figured maybe increasing this to 4096Mb will help with the processing so I went ahead and re-started the training with the following command

nohup opencv_traincascade -data data -vec board.vec -bg bg.txt -numPos 580 -numNeg 1160 -numStages 2 -w 115 -h 153 -featureType LBP -precalcIdxBufSize 4096 -precalcValBufSize 4096 &

The training has been running for almost 25 hours now and it also hasn't even produced the XML file for stage 0.

A look into the process itself states that its using 8284M of virtual memory but 930M of physical memory and this shows all the files currently in use by the process. Its doing a great job burning through my cores but none at producing any results or even letting me know how far its got.

My question(s) is/are, is there any way of making it use more of my actual physical memory in attempt to speed it up? If not, are there any adjustments I need to make on my training dataset?

Side Note: I know the general standard for dataset size is 24x24 but I already tried that out and it was really horrible even after 10 stages. At that size, my object's outline no longer attains its features correctly. At 24x24 or even 48x48 it looks like a giant horizontally distorted blob of black pixels without even some of its unique features being visible.

eshirima
  • 3,837
  • 5
  • 37
  • 61
  • is it stuck in collecting/finding negative samples or does it take so much time to compute the features? – Micka Jun 28 '17 at 15:44
  • ok, the choseb size is really unusually big. – Micka Jun 28 '17 at 15:49
  • From the nohup result, it seems like it is able to collect all of the negative samples. After looking at [other peoples results](https://stackoverflow.com/questions/26971769/opencv-haar-classifier-result-table-explanation), at least it prints out TRAINING 1-STAGE blah blah blah.. But it doesn't even get there on my trainer – eshirima Jun 28 '17 at 15:50
  • btw, HAAR is not using "shape" but "texture" so not sure whether HAAR cascades (and LBP) is the right choice for you. – Micka Jun 28 '17 at 15:51
  • can you post a screenshot? If using Windows 10 make sure you dont click in the console window because it wil enable a mark+copy mode and pause the application. – Micka Jun 28 '17 at 15:52
  • 1
    I can't post the actual object so the outline is the closest I can do.. But just imagine the middle portion as having a screen and some logos around the object – eshirima Jun 28 '17 at 15:54
  • if you try 24x32 window size, will your training reach 2nd stage fast? – Micka Jun 28 '17 at 15:55
  • A screenshot of? – eshirima Jun 28 '17 at 15:55
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/147850/discussion-between-eshirima-and-micka). – eshirima Jun 28 '17 at 15:56

1 Answers1

0

I bet that the problem is in samples size. The bigger size requires muuuuch bigger memory buffers and much more time. Detecting features is quite a difficult operation.

You have to minimize your samples (don't forget to rerum cv_createsamples(...)). Samples shouldn't be square it may be 25*15 (make sure proportions are saved and the biggest side is about 30px). You are using featureType LBP which itself is faster than Haar.

f4f
  • 891
  • 5
  • 13