Unable to figure out nInputPlane in SpatialConvolution in torch?
Question
Documentaion for Spatial Convolution define it as
module = nn.SpatialConvolution(nInputPlane, nOutputPlane, kW, kH, [dW], [dH], [padW], [padH])
nInputPlane: The number of expected input planes in the image given into forward().
nOutputPlane: The number of output planes the convolution layer will produce.
I don't have any experience with torch but i guess i have used a similar function in keras
Convolution2D(64, 3, 3, border_mode='same', input_shape=(3, 256, 256))
which takes as input the shape of the image that is 256*256 in rgb.
I have read usage of Spatial Convolution in torch as below but unable to figure out what does the nInputPlane and nOutputPlane paramter correspond to?
local convLayer = nn.SpatialConvolutionMM(384, 384, 1, 1, 1, 1, 0, 0)
In the code above what does these 384,384 represent ?
Solution
The nInputPlane is the depth or the number of the layers of the input image. In case of RGB images, this should be 3 which corresponds to the first number in the input_shape=(3, 256, 256)
.
The nOutputPlane is the the number of the layers of the volume that the convolution step will produce which is also the number of filters/kernels applied to the input. By convention, there is an output layer for each filter. This corresponds to the first argument of the Convolution2D
function.