我有一个关于tensorflow的问题:
CNN具有一个输入层,三个(CNN,MaxPooling)层,一个完全连接的隐藏层和一个输出层 . 当我使用model.summary()来显示架构时,我无法理解为什么有两个隐藏层 .
img_input = layers.Input(shape =(150,150,3))
x = layers.Conv2D(16,3,activation ='relu')(img_input)
x = layers.MaxPooling2D(2)(x)
x = layers.Conv2D(32,3,activation ='relu')(x)
x = layers.MaxPooling2D(2)(x)
x = layers.Conv2D(64,3,activation ='relu')(x)
x = layers.MaxPooling2D(2)(x)
x = layers.Flatten()(x)
x = layers.Dense(512,activation ='relu')(x)
output = layers.Dense(1,activation ='sigmoid')(x)
model = Model(img_input,output)
model.summary()
图层(类型)输出形状参数#
input_4(InputLayer)(无,150,150,3)0
conv2d_9(Conv2D)(无,148,148,16)448
max_pooling2d_9(MaxPooling2(无,74,74,16)0
conv2d_10(Conv2D)(无,72,72,32)4640
max_pooling2d_10(MaxPooling(无,36,36,32)0
conv2d_11(Conv2D)(无,34,34,64)18496
max_pooling2d_11(MaxPooling(无,17,17,64)0
flatten(Flatten)(无,18496)0
密集(密集)(无,512)9470464
flatten_1(展平)(无,512)0
dense_2(密集)(无,512)262656
dense_3(密集)(无,1)513
总参数:9,757,217
可训练的参数:9,757,217
不可训练的参数:0