MarvinTeichmann / tensorflow-fcn

An Implementation of Fully Convolutional Networks in Tensorflow.
MIT License
1.1k stars 433 forks source link

Some errors in Fuinction of FCN32_vgg #17

Closed rachit340 closed 7 years ago

rachit340 commented 7 years ago

In the file FCN32_vgg.py in the function of get_deconv_filter(self, f_shape): youa re doing for i in range(f_shape[2]): weights[:, :, i, i] = bilinear line 240. if the number of input channel is different from no of classes your weight initialization will not work. If you can explain why you did weights[:,:,i,i] instead of weights[:,:,i,j] and iterating over both i and j. it would be of great help.

MarvinTeichmann commented 7 years ago

get_deconv_filter performs bilinear upsampling. By definition this requires the number of input channels to be exactly the same as the number of output channels.

If you want more output k channels then input channels i, you could initialize the first i output channels to be upsampled verions of the inputs and use random initialization for k-i channels.

Also have a look at my explanation in #14

The weight is a 4-d tensor mapping k input channels to k output channels. The layer is supposed to upsample each channel independently, those the i^th output channel should become an upsampled Version of the i^th input channel. The value of the i^th channel should not be influenced by the values of any other channel.