0

我使用 keras 进行迁移学习。这就是我所做的:

  • 加载没有顶部的预训练模型(Mobilnet)。
  • 建立一些层的模型,输入是mobilnet的输出,输出是softmax(分类任务)
  • 现在我在瓶颈图像上训练顶级模型作为输入(通过 mobilnet 之后)
  • 最后,我想将顶级模型和 mobilnet 连接到完整模型,获得图像并预测分类。

伪代码:

mnet=MobileNet(include_top=False,pooling='max',
weights='imagenet',input_shape=(224,224,3))
my_net = bottle_neck = Input(shape=(1024,)) 
some_layer = Dense(100 ,activation='relu')(bottle_neck)  
...
final_layer=Dense(6,activation='softmax')(prev_layers)

我的目标是连接 mobilnet,我的网络没有火车又重新开始谢谢你

4

1 回答 1

-1

这在 Keras 文档中有所介绍,请参阅https://keras.io/applications/#fine-tune-inceptionv3-on-a-new-set-of-classes

关键是使用基础模型输出作为模型的输入(mnet.output),并将基础模型的到达层设置为trainable = False

于 2018-12-16T23:08:56.953 回答