Guest User

Untitled

a guest
Oct 16th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. # KERAS
  2.  
  3. conv_base = ResNet50(include_top=False,
  4. weights='imagenet')
  5.  
  6. for layer in conv_base.layers:
  7. layer.trainable = False
  8.  
  9. x = conv_base.output
  10. x = layers.GlobalAveragePooling2D()(x)
  11. x = layers.Dense(128, activation='relu')(x)
  12. predictions = layers.Dense(2, activation='softmax')(x)
  13. model = Model(conv_base.input, predictions)
  14.  
  15. optimizer = keras.optimizers.Adam()
  16. model.compile(loss='sparse_categorical_crossentropy',
  17. optimizer=optimizer,
  18. metrics=['accuracy'])
Add Comment
Please, Sign In to add comment