Various texts on using CNNs for object detection in images talk about how their translation invariance is a good thing. Which makes sense for tasks where the object could be anywhere in the image. Let's say detecting a kitten in household images.

But let's say, you already have some information about the likely position of the object of interest in the image. For example, for detecting trees in a dataset of images of landscapes. Here in most cases, the trees are going to be in the bottom half of the image while in some cases they might be at the top (because it's on a hill or whatever). So you want your neural network to learn that information -- that trees are likely connected to the bottom part of the image (ground). Is this possible using the CNN paradigm?

Thank you


2 Answers 2


According to your example:

Trees will likely be in the bottom half of the image. Still, you will not know whether there will be one, two or five trees. Thanks to translation invariance property of CNN's, each tree will activate filters responsible for tree detection. You still need to handle those few exceptions where trees are on hill.

To achieve better results in this particular case, you might want to consider some kind of focus mechanism, that will try to get rid of unwanted part of picture, in case when there are (for example) no hills. Take a look at Spatial Transformer Networks. During training it learns to predict spatial transformation (for example zoom) that will help "main" classifier to predict class of image.


I think, your assumption about the location of trees in images is quite incorrect. Just google image search "landscape" (if not already) and you will see almost equal number of images where the trees constitute top part of the image to those images where they lie in only the middle and bottom part.

Talking about the CNN, it automatically learns (thats the beauty!) the properties of an object which are there in the training images. By properties I mean the object's likely position, location, its shape color etc. If you visualize the CNN layer (mostly later layers) output, using class activated maps, you can see what CNN has learnt and paying attention to. Also, you can visualize the filters (or kernels) that are learned by the CNN.

  • $\begingroup$ maybe it was a bad one but the tree was just an example man $\endgroup$
    – simplename
    Commented May 25, 2018 at 6:07
  • $\begingroup$ Ya I got your point. It goes with pretty much everything except when you use CNN for self driving cars or any specific applications where the object detection area can be defined. $\endgroup$
    – mausamsion
    Commented May 25, 2018 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .