-
-
Save agnesmm/ce342d8e5da79da17a9bc27eb02ed496 to your computer and use it in GitHub Desktop.
This file contains 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 import backend as K | |
from keras.applications.vgg16 import VGG16 | |
from keras.layers import Flatten, Dense, Input | |
from keras.models import Model, load_model | |
from keras.optimizers import Adam, RMSprop, SGD | |
from keras.preprocessing.image import ImageDataGenerator | |
path = 'data/dogscats_redux/' | |
target_size = (224, 224) | |
batch_size = 64 | |
model_path = path + 'models/' | |
def get_batches(directory, target_size=target_size, batch_size=batch_size, shuffle=False): | |
datagen = ImageDataGenerator() | |
return datagen.flow_from_directory(directory=directory, | |
target_size=target_size, | |
batch_size=batch_size, | |
class_mode='categorical', | |
shuffle=shuffle) | |
batches = get_batches(path+'train', shuffle=True) | |
valid_batches = get_batches(path+'valid', batch_size=batch_size*2, shuffle=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment