In [2]:
from __future__ import print_function
import numpy as np
from matplotlib import pyplot as plt
In [8]:
with open("../../../basic-neural-network-notebook/mnist_dataset/mnist_test_10.csv#", "r") as data_file:
data_list = data_file.readlines()
count = 1
for row in data_list:
values = row.split(",")
label = values[0]
image_array = np.asfarray(values[1:]).reshape((28, 28))
plt.imshow(image_array, cmap="Greys", interpolation="None")
plt.savefig("data/mnist_digits/sample/valid/" + label + "/" + str(count) + ".jpg")
count = count + 1
In [9]:
from __future__ import division, print_function
##import utils; reload(utils)
##from utils import plots
import vgg16; reload(vgg16)
from vgg16 import Vgg16
In [31]:
vgg = Vgg16()
In [32]:
batch_size = 64
path = "data/mnist_digits/sample/"
In [33]:
batches = vgg.get_batches(path + "train", batch_size=batch_size)
val_batches = vgg.get_batches(path + "valid", batch_size=batch_size)
In [34]:
vgg.finetune(batches)
In [36]:
vgg.model.optimizer.lr = 0.01
vgg.fit(batches, val_batches, nb_epoch=10)
In [ ]: