<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Dogs vs Cats with vgg16
Setup
Step1:  Path to training and test data
Step2:  Vgg16 for basic image recognition
Step3:  finetune() modifies the model so that it will be trained based on the batched data provided (cat or dog)
Step4:  fit() the parameters of the model using the training data
<ASSISTANT_TASK:>
Python Code:
%matplotlib inline
Explanation: Dogs vs Cats with vgg16
Setup
End of explanation
#path = "data/dogscats/"
path = "data/dogscats/sample/"
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
import utils; reload(utils)
from utils import plots
Explanation: Path to training and test data
End of explanation
import vgg16; reload(vgg16)
from vgg16 import Vgg16
vgg = Vgg16()
batch_size = 64
batches = vgg.get_batches(path + "train", batch_size=batch_size)
val_batches = vgg.get_batches(path + "valid", batch_size=batch_size)
Explanation: Vgg16 for basic image recognition
End of explanation
vgg.finetune(batches)
Explanation: finetune() modifies the model so that it will be trained based on the batched data provided (cat or dog)
End of explanation
vgg.fit(batches, val_batches, nb_epoch=1)
Explanation: fit() the parameters of the model using the training data
End of explanation
<END_TASK>