Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 803 Bytes

img2cols.md

File metadata and controls

30 lines (22 loc) · 803 Bytes

Image to cols

REF

Can we convert convolution into matrix dot operation? ! Image to cols.

img2cols

Now, we can use dot operation to calculate cnn convolution!.

From this figure, given a matrix [N,C,H,W] and filter [K,K] we can get the resolution of converted matrix:

Colum size:

$$W' = C * K * K$$

Row size:

$$H' = N * (\frac{(W - K + P)}{S}+1) *(\frac{(H - K + P)}{S}+1)$$

In this context:

  • N is the number of samples.
  • C is the number of channels.
  • H is the height of the input matrix.
  • W is the width of the input matrix.
  • K is the size of the filter.
  • P is the padding applied to the input matrix.
  • S is the stride of the filter.