0

i do transfer-learning using keras. this is what i done:

  • load pre-trained model (Mobilnet) without top.
  • build model of some layers, input is output of mobilnet, and output is softmax (classification mission)
  • now i train the top model on the bottel-neck images as input (after go through mobilnet)
  • finally i want to connect top model and mobilnet to full model, who gets an images and predict classification.

pseudo code:

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)

my goal is to connect the mobilnet, and my net without train all over again thank u

sdcbr
  • 7,021
  • 3
  • 27
  • 44
  • Welcome to Stack Overflow. Please review [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) – Aurora Wang Dec 10 '18 at 20:38

1 Answers1

-1

This is covered in the Keras documentation, see https://keras.io/applications/#fine-tune-inceptionv3-on-a-new-set-of-classes

The key things are to use the base model output as the input of your model (mnet.output), and to set reach layer of the base model as trainable = False

Jon Nordby
  • 5,494
  • 1
  • 21
  • 50