Keras Conv2d Transpose

时间:2018-06-04 18:46:22

标签: python image-processing machine-learning keras convolution

我正在尝试使用Keras创建一个用于图像处理的完全卷积网络。我的初始网格是(10x25)并且我通过几个卷积层传递它然后尝试使用Conv2d Transpose尝试将图像调整回原始尺寸,但是我的反卷积层没有输出或者没有相反。您可以查看代码以查看正在执行的操作。

inputs = Input(shape = (input_shape)) 
conv1 = Conv2D(32, kernel_size=(2, 2), activation='relu', padding ='same')(inputs)
conv1 = Conv2D(32, (2, 2), strides = 1, activation='relu', padding ='same')(conv1)
pool1 = MaxPooling2D(pool_size=(2,2), padding = 'same')(conv1)

conv2 = Conv2D(64, (2, 2), strides = 1, activation='relu', padding ='same')(pool1)
conv2 = Conv2D(64, (2, 2), strides = 1, activation='relu', padding ='same')(conv2)
pool2 = MaxPooling2D(pool_size=(2,2), padding = 'same')(conv2)

 conv3 = Conv2D(128, (2, 2), strides = 1,  activation='relu', padding ='same')(pool2)
 conv3 = Conv2D(128, (2, 2), strides = 1, activation='relu', padding ='same') (conv3)
pool3 = MaxPooling2D(pool_size=(2,2), padding = 'same')(conv3)

deconv1 = Conv2DTranspose(64, kernel_size = (pool3.get_shape().as_list()[1:3]), strides = (2,2), data_format='channels_last')(conv3)
  conv4 = Conv2D(64, (2, 2), strides = 1, activation='relu', padding ='same')(deconv1)

deconv2 = Conv2DTranspose(32, kernel_size = (conv1.get_shape().as_list()[1:3]), strides = (2,2), data_format='channels_last')(conv4)
conv5 = Conv2D(32, (2, 2),strides = 1, activation='relu', padding ='same')(deconv2)

deconv3 =  Conv2DTranspose(1, kernel_size = (input_shape[0:2]), data_format='channels_last')(conv5)
conv6 = Conv2D(1, (1, 1), strides = 1,  activation=act_identity)(deconv3)

0 个答案:

没有答案