# How to reduce the resolution of a Image(276*276 --> 48*48) without affecting the features in it

I have an image with resolution of $276*276$. I've created a Convolution Neural Network which accepts $48*48$ images. So, I want to resize that $276*276$ image to $48*48$ without reducing any features in the data. Can anyone help me solve this problem so that I will send the resized images as the input to my CNN model?

• I think we'd all like to reduce our data by a factor of 30 without affecting the features in it :-) – Philip Kendall Jun 17 at 20:41

## 2 Answers

At least as far as I know reducing the size of images is always lossy and you can not retrieve the original image due to the fact that you are throwing away information. Although there are solutions for dimensionality reduction like PCA, they are linear approaches. It depends on your task that what you want to do but there is a solution if you have a classification problem. Try to use a spatial transformer module before the input of the predefined network and send the output of that module to your predefined network. For your grid sampler, you can set the size of the grid to $48 * 48$. For more details take a look at here.

Concretely, the grid generator first creates a normalized meshgrid of the same size as the input image U of shape $(H, W)$, that is, a set of indices $(x^t,y^t)$ that cover the whole input feature map (the subscript $t$ here stands for target coordinates in the output feature map). Then, since we’re applying an affine transformation to this grid and would like to use translations, we proceed by adding a row of ones to our coordinate vector to obtain its homogeneous equivalent. This is the little trick we also talked about last week. Finally, we reshape our 6 parameter $θ$ to a $2x3$ matrix and perform the following multiplication which results in our desired parametrised sampling grid... since bilinear interpolation is differentiable, it is perfectly suitable for the task at hand. Armed with the input feature map and our parametrised sampling grid, we proceed with bilinear sampling and obtain our output feature map $V$ of shape $(H’, W’, C’)$. Note that this implies that we can perform downsampling and upsampling by specifying the shape of our sampling grid. (take that pooling!) We definitely aren’t restricted to bilinear sampling, and there are other sampling kernels we can use, but the important takeaway is that it must be differentiable to allow the loss gradients to flow all the way back to our localisation network.

As far as I can tell, every pixel is considered a feature, so reducing the number of pixels would definitely affect the features. What you really mean is how to reduce the size of the image without losing out on the most important features or most important feature patterns. It's hard to tell but worth trying a few experiments.

1) Bicubic interpolation (imresize in MATLAB does this )

2) Add pooling layers before you start convolutions

3) Pyramidal pooling- as far as I know, this works well. Here's a link

4) As explained in the previous answer you could try dimension reduction such as PCA which is linear or you could try something like t-SNE which is non-linear.