Skip to content

Instantly share code, notes, and snippets.

@agnesmm agnesmm/ Secret
Last active Sep 17, 2017

What would you like to do?
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,
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
You can’t perform that action at this time.