1
$\begingroup$

I have a grayscale image with dimension HxWx1 (one channel). To build a CNN using the grayscale image as an input image, what is the dimension of the filters?

I read from some websites, it says that if the input image has only one channel, then the filter must be NxNx1. However, some other websites mentioned differently. It says even if the input image has one channel, it is fine to use filters with dimension NxNx3 by simply converting the grayscale image (HxWx1) to a RGB image (HxWx3).

Therefore, my question is: with input image that has only 1 channel, must the dimension of the filter be NxNx1 or NxNx3?

(I self-study this, so I might get the idea and understanding wrong. Help me, please.)

Note; H: height, W: width, N: height and width of the filter

$\endgroup$
0
$\begingroup$

It is better, in most cases, to convert Grayscale images to RGB images with equal corresponding values in the 3 channels.

In this case, your filter size will be NxNx3.

The reason this approach is preferred is, among other things, if some time in future, you decide to use a pre-trained CNN you would most definitely need an RGB image to use its weights.

| improve this answer | |
$\endgroup$
0
$\begingroup$

if your network is for grayscale images, its first layer filter size should be NxNx1. if you want to use a network which has NxNx3 filter on the input image, you should concatenate each image with itself 3 times to get an NxNx3 image.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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