1
$\begingroup$

I have an existing CNN architecture which gets an image (size: $640 × 352$) and returns and image of the same size ($640 × 352$, via convolution and deconvolution). And I'm trying to halve the output size of the first convolution layer for better performance. The thing is: I want that the rest of the network works as before (aside from adding a $2 ×$-up-convolution at the end).

So I have an image the size of $640 × 352$. Originally a convolution with stride $ S = 2 $ and a filter kernel with size $ 7 × 7 $ is applied. Padding is zero: $ P = 0 $.

Now I want to change the convolution to return an output halve the size of the former output size of the convolution, so I just need to add an additional $2×$-deconvolution at the end, for the same result.

I played a little bit around and tried something like $ F = 8 $ and $ S = 4 $ which seems to work for the first dimension, but not for the second. It returns $640×384$.

Any ideas how to realize this?

$\endgroup$
0
$\begingroup$

Halve the size of the input images by combining values in adjacent cells. If you want exactly half, and wish to keep the same aspect ratio, you will have to interpolate to make 452.5483399593904156165403917471 by 271.52900397563424936992423504826 pixels, $\Big($note: $\dfrac{1}{\sqrt{2}}\dfrac{1}{\sqrt{2}}=\dfrac{1}{2}\Big)$ which doesn't seem like a good idea. If you are willing to combine 1.5 adjacent pixels by interpolation you could make a 480 by 264 pixel original image, which would be 56.25% of the original size.

Alternatively, a better procedure would be to use, for example, a $\dfrac{3}{4}$ size image of the output of the full convolution because the two imaging convolutions (resizing, and your convolution) are not commutative in favor of convolution first then resizing. Note, $\dfrac{3}{4}*\dfrac{3}{4}=\dfrac{9}{16}$ or just one sixteenth larger than $\dfrac{1}{2}$. If you want 47.2656% you could use $\dfrac{11}{16}$ for a 440 by 242 image, but that makes interpolation more complicated.

There are many other answers. It is unclear what you want and why you want it. For example, you could use lossless compression with among others jpg2000, or tif. If you want exactly a one-half file size, (What for?) you could use a lossy compression with jpg chosen to yield that image information content in bits.

$\endgroup$

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