2
$\begingroup$

I have CNN with Tensorflow for gray images with weights

w1=[9,9,1,64], w2 = [1,1,64, 32] and w3 = [5,5,32,1]

Now I want to use RGB 3 channel data instead of gray scales. Can anybody help me how to change

w1, w2, and w3

for RGB images?

Is it possible to use conv2d function for RGB images in Tensorflow?

$\endgroup$

1 Answer 1

1
$\begingroup$

Change $w1=[9,9,1,64]$ to $w1=[9,9,3,64]$. The first two numbers specify the size of the filter, the third specifies the number of input channels and the last one specifies the number of output filters.

Is it possible to use conv2d function for RGB images in Tensorflow?

Yes, conv2d is used for one channel, grey level, images and three channel images, coloured images.

$\endgroup$
2
  • $\begingroup$ Thank you so much for your reply but what about the w2 and w3 ?? In case of gryascale image it take one channel image and produce one channel output. But Now I input RGB image and want the out put is also RGB. So is W2 = [1,1,64,32] and w3= [5,5,32,3] will be correct ?? $\endgroup$ Jul 11, 2018 at 7:54
  • $\begingroup$ I don't know what your task is, but as you have mentioned if you want to have an output with three channels, you should have three filters in your last layer. Consequently, what you have mentioned is correct, but consider that the output is not going to be necessarily what you want due to the fact that its the result of some non-linear operations and its not going to be a meaningful image. $\endgroup$ Jul 11, 2018 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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