这张图片的模型正是我所需要的.
但当我使用netron.app
获取模型 struct 时,我发现我的代码似乎是错误的.
似乎我把两个图像组合成了一个六通道,并对其进行了训练.
conv_base = tf.keras.applications.InceptionResNetV2(weights=None,include_top=False ,
input_broc = tf.keras.Input(shape=(299, 299, 3))
input_temp = tf.keras.Input(shape=(299, 299, 3))
x_broc = conv_base(input_broc)
x_temp = conv_base(input_temp)
x_broc = tf.keras.layers.GlobalAveragePooling2D()(x_broc)
x_temp = tf.keras.layers.GlobalAveragePooling2D()(x_temp)
x = tf.keras.layers.Concatenate()([x_broc, x_temp])
x = tf.keras.layers.Dense(7, activation='softmax')(x)
model = tf.keras.Model(inputs=[input_broc, input_temp], outputs=x)
Model: "model_1"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_5 (InputLayer) [(None, 299, 299, 3) 0
__________________________________________________________________________________________________
input_6 (InputLayer) [(None, 299, 299, 3) 0
__________________________________________________________________________________________________
inception_resnet_v2 (Functional (None, 8, 8, 1536) 54336736 input_5[0][0]
input_6[0][0]
__________________________________________________________________________________________________
global_average_pooling2d_2 (Glo (None, 1536) 0 inception_resnet_v2[0][0]
__________________________________________________________________________________________________
global_average_pooling2d_3 (Glo (None, 1536) 0 inception_resnet_v2[1][0]
__________________________________________________________________________________________________
concatenate_1 (Concatenate) (None, 3072) 0 global_average_pooling2d_2[0][0]
global_average_pooling2d_3[0][0]
__________________________________________________________________________________________________
dense_1 (Dense) (None, 7) 21511 concatenate_1[0][0]
==================================================================================================
自定义数据生成器返回它
return [X1, X2], y