Ask Your Question

eTicket's profile - activity

2018-07-02 18:33:51 -0600 received badge  Notable Question (source)
2017-11-25 23:11:42 -0600 received badge  Popular Question (source)
2016-07-23 11:49:34 -0600 received badge  Scholar (source)
2016-07-23 11:49:32 -0600 commented answer How to train classifiers the best way possible

@StevenPuttemans thank you, i will look into your reference, looks really useful at first glance! Regarding the nagtive window extraction, i am going to do it the normal way then. Like that the training works as expected.

2016-07-21 12:47:06 -0600 commented answer How to train classifiers the best way possible

@PedroBatista Yes i know. I am just referring to the article, which suggests to extract the negatives from the images where the object is present. That (in theory) is better because the negatives will be more related to the positives. I am particularly unsure about the scaling operation though. OpenCV scales the positive samples to the training size too. So for the negatives i thought extracting unrelated regions with the same size as the object and scaling those down to the training size makes sense. Its not that its not possible for me to find negative images with similar backgrounds, but its actually harder than you might think.

2016-07-21 12:13:41 -0600 received badge  Supporter (source)
2016-07-21 12:13:39 -0600 commented answer How to train classifiers the best way possible

First of all thank you for your answer. I have edited my question and added my training parameters. Could you tell me if my way of extracting the negative images is ok? As i've written, i have a software that extracts them directly out of the positive images. My negative regions that i am selecting have the same size as the object in the image. After extraction my software scales them down to the train window size. So the images in negatives.txt all have the dimensions 40x40. Also given the complexity of my fried egg example, could you guess how many images would be needed. How do i know if i have too less? I am going to test your suggestion to decrease the number of negatives. I'll get back when i tried that.

2016-07-21 09:27:41 -0600 received badge  Student (source)
2016-07-21 08:14:33 -0600 received badge  Editor (source)
2016-07-21 07:58:48 -0600 asked a question How to train classifiers the best way possible

Hello,

i am trying to train a cascade classifier with opencv_traincascade. There are a few tutorials and posts about that, but all of them seem to be either outated or are contradictory. Also i am interested in doing things the best way possible, not just getting it to work. I am going to tell you what i learned so far, and what is unclear to me.


Acquiring positive samples

There are two methods:

  • Using a single (or few) images and use OpenCV's createsamples utility to generate a lot of samples from them. In case of more then one image, the resulting *.vec files are merged with a special utility.

  • Using multiple annoted images and feeding them to createsamples with the -info option. This does not create more samples, it just extracts them.

The first approach seems to be used by a lot of people, mainly because you dont need annoted images and can create a large number of samples from just a few images. But I've read that the first approach is really bad and one should use the seccond approach because it provides real world samples that are more likely to match the input images in a real application. Some people say that taking a smaller number of real world images is way better then using a really large number of generated artificial samples.

I currently have about 300 annoted samples at hand. I could directly feed them to createsamples (with -info).

  • 300 samples are not a huge amount, but those are "real world" samples. Referring to the above statements i might not need more. By how much are real world samples actually better then generated ones? Are 300 samples enough?
  • Otherwise would it make sense to create about 10 artificial samples per real world sample using createsamples and merge those *.vec files? This way i would have 3000 samples.

Acquiring negative samples

Most people use random images from the internet as negatives to train. But i read throught this Article which is suggesting a better approach:

Creating negatives from the backgrounds of the positives is much more “natural” and will give far better results, than using a wild list of background images taken from the Internet.

Also:

I would avoid leaving OpenCV training algorithm create all the negative windows. To do that, create the background images at the final training size so that it cannot subsample but only take the entire negative image as a negative.

If i understand this right, the author suggests to take the images containing the object and extract negative samples from the regions around the object, also making sure those extracted negatives have the same size as the training window.

  • Does that make sense? I looked at his git repository and his negatives where a lot larger then the training window. Do i miss something?

  • Also, should i extract regions with the window size out of the images, or could i use larger portions with the same aspect ratio and scale ...

(more)