clvrai / BicycleGAN-Tensorflow

A Tensorflow implementation of BicycleGAN.
MIT License
101 stars 31 forks source link

residual does not have an activation layer keyword #1

Closed irfanICMLL closed 6 years ago

irfanICMLL commented 6 years ago

It is a great work for your implementation~~ I think there is smoething going wrong in this code.. in ops line 98: def residual(input, num_filters, name, istrain, reuse, norm, pad='REFLECT', bias=False) But in encoder line 57: E = ops.residual(E, n, 'res{}{}'.format(n, i + 1), self._is_train, self._reuse, norm=self.norm, activation='leaky', bias=True) The anctivation layer in the reidual block is 'relu' in your ops. What is going on?...I feel confused~ Maybe the line 57 in encoder need to be : E = ops.residual(E, n, 'res{}{}'.format(n, i + 1), self._is_train, self._reuse, norm=self._norm, bias=True)

irfanICMLL commented 6 years ago

What's more the residual block return input+output but the output ndf is 64 128 256 etc. The input 64 can not add to the output 128...How to deal with this ? Maybe I have done something wrong...

irfanICMLL commented 6 years ago

I think maybe the residual block should be: def residual(input, input_ndf,num_filters, name, is_train, reuse, norm, pad='REFLECT', bias=False): with tf.variable_scope(name, reuse=reuse): with tf.variable_scope('res1', reuse=reuse): out = _norm(input, is_train, reuse, norm) out = tf.nn.relu(out) out = conv2d(out, input_ndf, 3, 1, reuse, pad, bias=bias) with tf.variable_scope('res2', reuse=reuse): out = _norm(out, is_train, reuse, norm) out = tf.nn.relu(out) out = conv2d(out, num_filters, 3, 1, reuse, pad, bias=bias) out = tf.nn.avg_pool(out, [1, 2, 2, 1], [1, 2, 2, 1], 'SAME') with tf.variable_scope('shortcut', reuse=reuse): input = tf.nn.avg_pool(input, [1, 2, 2, 1], [1, 2, 2, 1], 'SAME') input = conv2d(input, num_filters, 1, 1, reuse, pad, bias=bias) return input + out

which can have the same structure as the pytorch version.

youngwoon commented 6 years ago

I fixed this issue (https://github.com/gitlimlab/BicycleGAN-Tensorflow/commit/af75776f8ea7496672401c8e8c447420f79e9ce3). Bug reports are greatly appreciated!