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 >
source share