在 Keras 中加载预训练的 MobileNet 模型并设置其参数 num_classes=10,可以这样做:
from keras.applications import MobileNet
# 设置模型参数,注意 include_top=False 表示不包括最后一层全连接层
model = MobileNet(weights=None, input_shape=(224, 224, 3), classes=10, include_top=False)
在 Keras 中加载预训练的 MobileNet 模型并设置其参数 num_classes=10,可以这样做:
from keras.applications import MobileNet
# 设置模型参数,注意 include_top=False 表示不包括最后一层全连接层
model = MobileNet(weights=None, input_shape=(224, 224, 3), classes=10, include_top=False)