I can't figure out what preprocessing of the image is needed before feeding it into the convolutional neural network. For example, I want to recognize circles on a 1000 by 1000 px photo. The learning process of a neural network occurs on 100 by 100 px (https://www.kaggle.com/smeschke/four-shapes/data). I'm having a little difficulty wrapping my head around the situation when the circle in the input image is much larger (or smaller) than 100x100 px. How then the convolution neural network determines that circle if it was learned on a dataset of a different picture's size.

For clarity, I want to submit a 454 by 430 px image to the network input:

enter image description here

Example of the dataset for the learning process (100 by 100 px):

enter image description here

Finally, I want to recognize all the circles on the input image:

enter image description here


1 Answer 1


If you have a trained network that accepts input of 100 * 100 you can either scale your image accordingly or slice it into smaller parts.

Scaling the image

Scaling your image down is really straight forward. It will lower the information and might distort it too if your aspect ratio doesn't match. In your case it is a little off, but most networks are trained with a little distortion.

You will have to ask yourself if the details you are interested in are still discernable, and whether they (still) match the examples the network is trained on.

Slicing smaller parts

If you are interested in features rather than the larger scene, you could slice your image into bits of 100 * 100. I recommend you use a sliding window, wherein you tile the subsamples as if they were shingles. That way you avoid that a feature is only availble in bit's and doenst get recognized.

  • $\begingroup$ I think, that slicing smaller parts is a more suitable option for me. Would you please explain the following: when I am slicing my image into 100 by 100. Then the network starts scanning for circle features. But in learning dataset circle covers approximately 75 % of the image. In my situation, it seems more like a point (my circle cover <10% of section 100 by 100. Imagine that filter gets inside the sector, where one of the circles is. How the network recognizes this circle in this case. $\endgroup$
    – Shyrokoa
    May 12, 2020 at 14:16
  • 1
    $\begingroup$ The complete answer to that question involves reading up on filterbank learning, convolutions, and the concept of stacking those into conceptual hierarchies, amongst which using pooling. That stack introduces invariance enabling it to generalize beyond what it has seen. However: CNN's arent geniuses that automagically understand all the generalization and intend you add to the problem. It might work, but it might also be smart to gauge whether this works and if not adept. FI: Either adapt the trainset or scale up the picture before slicing. $\endgroup$ May 12, 2020 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.