Random increase in convolutional neural network crop data

I train a convolutional neural network, but have a relatively small data set. Therefore, I use methods to increase it. Now this is the first time I am working on a computer vision problem, therefore a relatively newbie. To increase, I read a lot of methods, and one of them, which is mentioned a lot in the articles, is random cropping. Now I'm trying to implement it, I searched a lot for this technique, but could not find the correct explanation. So there were a few queries:

How does random cropping really help in increasing data? Is there any library (e.g. OpenCV, PIL, scikit-image, scipy) in python that implements random cropping implicitly? If not, how do I implement it?

+6
source share
2 answers

In my opinion, random cropping helps to increase the amount of data, since the semantics of the image are preserved (if you have not chosen a really bad culture, but suppose you are setting random cropping so that it is very low probability) the activation values โ€‹โ€‹that you get in your Networks are different. Thus, in essence, our assembly line learns to associate a wider range of spatial activation statistics with a specific class label, and thus increasing data through random cropping helps to increase the reliability of function detectors in networks. Also in the same vein, a random crop produces different intermediate activation values โ€‹โ€‹and creates another jumper so that it is like a โ€œnew training pointโ€.

This is also not trivial. See Recent work on controversial examples on neural networks (relatively small in size by AlexNet). Images that semantically look the same, more or less, when we transfer them through a neural network with the softmax classifier on top, we can get completely different class probabilities. Thus, subtle changes from a semantic point of view can lead to different passage forward through the conv network. See the intriguing properties of neural networks for more details.

To answer the last part of your question: usually I just make my own random crop script. Say my images are (3, 256, 256) (3 RGB channels, spatial size 256x256), you can encode a loop that takes 224x224 random crops of your image, just randomly choosing a valid corner point. Therefore, I usually compute an array of real corner points, and if I want to take 10 random crops, I randomly select 10 different corner points from this set, for example, I select (x0, y0) for my upper left corner point, I will select crop X [ x0: x0 + 224, y0: y0 + 224], something like this. I personally would like to randomly select from a pre-computed set of valid corner points instead of randomly selecting the corner one at a time, because in this way I guarantee that I will not get a duplicate crop, although in reality this is probably a low probability. / P >

+9
source

To answer the question "how to implement cropping", you may need to study https://github.com/aleju/imgaug . There is an available Crop Augmentor that allows you to do custom cropping. And many other funny augmenters.

0
source

All Articles