卷积、池化、上采样、融合、反卷积、转置卷积、图层大小与参数的计算。
1、如下代码,包含卷积、池化、上采样、融合、反卷积、转置卷积。
import keras
import numpy as np
from keras.layers import Conv2D,Dense,Flatten,BatchNormalization,Activation,Input,UpSampling2D
from keras.layers import concatenate,MaxPooling2D,Conv2DTranspose,Deconvolution2D
from keras import Model
def net(input_shape=(128,128,3)):
X = Input(input_shape)
conv1 = Conv2D(64, (3, 3), padding='same', kernel_initializer='he_normal', name='con1')(X) # 进行一次卷积
conv1 = BatchNormalization()(conv1) # 进行一次批量归一化
conv1 = Activation('relu')(conv1) # 设置激活函数
pool1 = MaxPooling2D((2, 2), name='pool1')(conv1) # 进行一次池化
up1 = UpSampling2D(size=(2, 2), name='up1')(pool1) # 进行上采样
merge1 = concatenate([conv1, up1], name='mer1', axis=-1) # 进行一次合并
deconv1 = Deconvolution2D(64, (3, 3),padding='same',kernel_initializer='he_normal',name='deconv1')(merge1) #进行一次反卷积
score1 =<