Skip to content

Instantly share code, notes, and snippets.

@darraghoriordan
Created September 26, 2017 08:39
Show Gist options
  • Save darraghoriordan/84ef21f04f9c367fdda0e57420d48ca7 to your computer and use it in GitHub Desktop.
Save darraghoriordan/84ef21f04f9c367fdda0e57420d48ca7 to your computer and use it in GitHub Desktop.
batch_size=64
no_of_epochs=1
# do it
vgg = Vgg16()
# Grab a few images at a time for training and validation.
# NB: They must be in subdirectories named based on their category
train_batches = vgg.get_batches(train_path, batch_size=batch_size)
val_batches = vgg.get_batches(valid_path, batch_size=batch_size*2)
vgg.finetune(train_batches)
vgg.model.optimizer.lr = 0.01
vgg.fit(train_batches, val_batches, nb_epoch=no_of_epochs)
Found 23000 images belonging to 2 classes.
Found 2000 images belonging to 2 classes.
Epoch 1/1
23000/23000 [==============================] - 654s - loss: 0.3473 - acc: 0.9701 - val_loss: 0.1633 - val_acc: 0.9865
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment