akashtadwai

Test

Dec 28th, 2019
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. from tensorflow.keras.applications import ResNet50
  2. from tensorflow.keras.models import Sequential
  3. from tensorflow.keras.layers import Dense, InputLayer, Flatten, GlobalAveragePooling2D
  4. num_classes = 2
  5. IMG_SIZE = 224
  6. IMG_SHAPE = (IMG_SIZE, IMG_SIZE, 3)
  7. resnet_weights_path='/content/drive/My Drive/Colab Notebooks/Copy of resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5'
  8. my_new_model = Sequential()
  9. my_new_model.add(ResNet50(include_top=False, pooling='avg', weights=resnet_weights_path,input_shape=IMG_SHAPE,classes=2))
  10. my_new_model.add(Dense(num_classes, activation='softmax'))
  11. my_new_model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
Add Comment
Please, Sign In to add comment