Skip to main content
deleted 22 characters in body
Source Link
Brian Spiering
  • 22.3k
  • 2
  • 28
  • 113

I could not get your example to run but. Here is a code like this can buildsample where a new model built from parts of an existing model:

# Explicitly define new model input and output by slicing out old model layers
model_new = Model(input=model_old.layers[0].input, 
                  output=model_old.layers[12].output)

# Compile model to inspect
model_new.compile(optimizer='rmsprop',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

# Visually inspect new model to confirm it the correct architecture
model_new.summary()
# Explicitly define new model input and output by slicing out old model layers
model_new = Model(input=model_old.layers[0].input, 
                  output=model_old.layers[12].output)

# Compile model to inspect
model_new.compile(optimizer='rmsprop',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

# Visually inspect new model to confirm it has the correct architecture
model_new.summary()

I could not get your example to run but code like this can build a new model from parts of an existing model

# Explicitly define new model input and output by slicing out old model layers
model_new = Model(input=model_old.layers[0].input, 
                  output=model_old.layers[12].output)

# Compile model to inspect
model_new.compile(optimizer='rmsprop',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

# Visually inspect new model to confirm it the correct architecture
model_new.summary()

I could not get your example to run. Here is a code sample where a new model built from parts of an existing model:

# Explicitly define new model input and output by slicing out old model layers
model_new = Model(input=model_old.layers[0].input, 
                  output=model_old.layers[12].output)

# Compile model to inspect
model_new.compile(optimizer='rmsprop',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

# Visually inspect new model to confirm it has the correct architecture
model_new.summary()
added 6 characters in body
Source Link
Brian Spiering
  • 22.3k
  • 2
  • 28
  • 113

I could not get your example to run but code similar tolike this can build a new model from parts of an existing model

# Explicitly define new model input and output by slicing out old model layers
model_new = Model(input=modelinput=model_old.layers[0].input, 
                  output=modeloutput=model_old.layers[12].output)

# Compile model to inspect
model_new.compile(optimizer='rmsprop',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

# Visually inspect new model to confirm it the correct architecture
model_new.summary()

I could not get your example to run but code similar to this can build a new model from parts of an existing model

# Explicitly define new model input and output by slicing out model layers
model_new = Model(input=model.layers[0].input, 
                  output=model.layers[12].output)

# Compile model to inspect
model_new.compile(optimizer='rmsprop',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

# Visually inspect new model to confirm it the correct architecture
model_new.summary()

I could not get your example to run but code like this can build a new model from parts of an existing model

# Explicitly define new model input and output by slicing out old model layers
model_new = Model(input=model_old.layers[0].input, 
                  output=model_old.layers[12].output)

# Compile model to inspect
model_new.compile(optimizer='rmsprop',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

# Visually inspect new model to confirm it the correct architecture
model_new.summary()
Source Link
Brian Spiering
  • 22.3k
  • 2
  • 28
  • 113

I could not get your example to run but code similar to this can build a new model from parts of an existing model

# Explicitly define new model input and output by slicing out model layers
model_new = Model(input=model.layers[0].input, 
                  output=model.layers[12].output)

# Compile model to inspect
model_new.compile(optimizer='rmsprop',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

# Visually inspect new model to confirm it the correct architecture
model_new.summary()