In [1]:
%matplotlib inline
Path to training and test data
In [13]:
#path = "data/dogscats/"
path = "data/dogscats/sample/"
In [3]:
from __future__ import division, print_function
import os, json
from glob import glob
import numpy as np
np.set_printoptions(precision=4, linewidth=100)
from matplotlib import pyplot as plt
In [4]:
import utils; reload(utils)
from utils import plots
In [7]:
import vgg16; reload(vgg16)
from vgg16 import Vgg16
In [9]:
vgg = Vgg16()
In [10]:
batch_size = 64
In [14]:
batches = vgg.get_batches(path + "train", batch_size=batch_size)
val_batches = vgg.get_batches(path + "valid", batch_size=batch_size)
finetune() modifies the model so that it will be trained based on the batched data provided (cat or dog)
In [15]:
vgg.finetune(batches)
fit() the parameters of the model using the training data
In [16]:
vgg.fit(batches, val_batches, nb_epoch=1)
In [ ]: