Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tensorflow.keras.applications import ResNet50
- from tensorflow.keras.models import Sequential
- from tensorflow.keras.layers import Dense, InputLayer, Flatten, GlobalAveragePooling2D
- num_classes = 2
- IMG_SIZE = 224
- IMG_SHAPE = (IMG_SIZE, IMG_SIZE, 3)
- resnet_weights_path='/content/drive/My Drive/Colab Notebooks/Copy of resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5'
- my_new_model = Sequential()
- my_new_model.add(ResNet50(include_top=False, pooling='avg', weights=resnet_weights_path,input_shape=IMG_SHAPE,classes=2))
- my_new_model.add(Dense(num_classes, activation='softmax'))
- my_new_model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
Add Comment
Please, Sign In to add comment