2017-08-17 4 views
0

FCNモデルのテンソルフローでデコンボリューションレイヤーを実装したいが、私は5つのコンバーター出力のそれぞれに対してtf.nn.conv2d_transposeを使用した。私が必要とするのは、 deconvは入力画像の形状と同じになるようにします。だから私は設定したtf.nn.conv2d_transpose output_shape for FCN

deconv_shape = tf.shape(input) 
tf.nn.conv2d_transpose(value=deconv5_1, 
         filter=[32, 32, 1, 1], 
         output_shape=deconv_shape, 
         strides=16, 
         padding="same", 
         name="deconv5_2") 

私はそれを正しくやっていますか?

答えて

0

私はあなたの実装が正しくないと思う、ここでそれを正しくするためのいくつかのステップがあります。

in_channels = input.shape[-1] 
# here set the output_height, width as [stride*input_height, stride*input_width]] 
output_shape = [batch_size, output_height, output_width, out_channels] 
filter_size =2 # for example 
stride = 2 # for example if you want 2x scale of input height, width 
shape = [filter_size, filter_size, out_channels, in_channels] 
w = tf.get_variable(
     name='W', 
     shape=shape, 
     initializer=w_init, 
     regularizer=w_regularizer, 
     trainable=trainable 
) 

output = tf.nn.conv2d_transpose(
     input, w, output_shape=output_shape, strides=[1, stride, stride, 1]) 
関連する問題