在定义LetNet5网络模型时候,遇到了下述问题
此为图片通道数据格式问题
def LeNet5(w_path=None):
input_shape = (1, img_rows, img_cols)
img_input = Input(shape=input_shape)
x = Conv2D(32, (3, 3), activation="relu", padding="same", name="conv1") (img_input)
x = MaxPooling2D((3, 3), strides=(2, 2), name='pool1')(x)
x = Conv2D(64, (3, 3), activation="relu", padding='same', name='conv2')(x)
x = MaxPooling2D((2, 2), strides=(2, 2), name='pool2')(x)
x = Dropout(0.25)(x)
x = Flatten(name='flatten')(x)
x = Dense(128, activation='relu', name='fc1')(x)
x = Dropout(0.5)(x)
x = Dense(128, activation='relu', name='fc2')(x)
x = Dropout(0.5)(x)
x = Dense(10, activation='softmax', name='predictions')(x)
model = Model(img_input, x, nam