This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from tensorflow.contrib.keras.python.keras.models import Model | |
| from tensorflow.contrib.keras.python.keras.layers import GlobalAveragePooling2D, Dense | |
| from tensorflow.contrib.keras.python.keras.applications import ResNet50 | |
| from tensorflow.contrib.keras.python.keras.optimizers import Adam | |
| from tensorflow.contrib.keras.python.keras.preprocessing.image import ImageDataGenerator | |
| from tensorflow.contrib.keras.python.keras.callbacks import ModelCheckpoint, EarlyStopping | |
| base_model = ResNet50(weights='imagenet', include_top=False, input_shape=shape) | |
| x = base_model.output | |
| x = GlobalAveragePooling2D()(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import glob | |
| import os | |
| import cv2 | |
| from keras.preprocessing.image import ImageDataGenerator | |
| datagen = ImageDataGenerator( | |
| horizontal_flip=True, | |
| vertical_flip=True, | |
| rotation_range= 90, | |
| zoom_range=0.1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from keras.models import Model, load_model | |
| from keras import applications | |
| from keras import optimizers | |
| from keras.layers import Flatten, Dense | |
| base_model = applications.ResNet50(weights='imagenet', include_top=False, input_shape=(224, 224, 3)) | |
| x = base_model.output | |
| x = Flatten()(x) | |
| x = Dense(3)(x) | |
| model = Model(inputs=base_model.input, outputs=x ) |