我正在尝试在 kaggle 上运行具有 nosiy 学生权重的高效网络 B7 模型,但出现错误:
You are trying to load a weight file containing 436 layers into a model with 437 layers.
我的代码:
model_path = '../input/keras-efficientnet-noisy-students/efficientnet-b7_noisy-student_notop.h5'
n_labels = labels.shape[1]
with strategy.scope():
model = tf.keras.Sequential([
efn.EfficientNetB7(
input_shape=(size, size, 3),
weights=model_path,
include_top=False,
drop_connect_rate=0.5),
tf.keras.layers.GlobalAveragePooling2D(),
tf.keras.layers.Dense(n_labels, activation='sigmoid')
])
model.compile(
optimizer='adam',
loss='binary_crossentropy',
metrics=[tf.keras.metrics.AUC(multi_label=True)])
model.summary()