<jupyter_start><jupyter_text>Prepare data<jupyter_code>from __future__ import print_function
import numpy as np
from matplotlib import pyplot as plt
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<jupyter_output><empty_output><jupyter_text>Vgg16 for basic image recognition<jupyter_code>from __future__ import division, print_function
##import utils; reload(utils)
##from utils import plots
import vgg16; reload(vgg16)
from vgg16 import Vgg16
vgg = Vgg16()
batch_size = 64
path = "data/mnist_digits/sample/"
batches = vgg.get_batches(path + "train", batch_size=batch_size)
val_batches = vgg.get_batches(path + "valid", batch_size=batch_size)
vgg.finetune(batches)
vgg.model.optimizer.lr = 0.01
vgg.fit(batches, val_batches, nb_epoch=10)<jupyter_output>Epoch 1/10
101/101 [==============================] - 4s - loss: 7.9990 - acc: 0.4455 - val_loss: 6.4609 - val_acc: 0.6000
Epoch 2/10
101/101 [==============================] - 4s - loss: 8.0895 - acc: 0.3960 - val_loss: 6.6159 - val_acc: 0.5000
Epoch 3/10
101/101 [==============================] - 4s - loss: 8.1155 - acc: 0.4455 - val_loss: 6.4580 - val_acc: 0.6000
Epoch 4/10
101/101 [==============================] - 4s - loss: 7.5789 - acc: 0.4950 - val_loss: 7.6657 - val_acc: 0.4000
Epoch 5/10
101/101 [==============================] - 4s - loss: 8.2343 - acc: 0.3861 - val_loss: 7.2692 - val_acc: 0.4000
Epoch 6/10
101/101 [==============================] - 4s - loss: 7.8978 - acc: 0.4653 - val_loss: 6.5097 - val_acc: 0.6000
Epoch 7/10
101/101 [==============================] - 4s - loss: 7.3871 - acc: 0.5149 - val_loss: 6.4544 - val_acc: 0.6000
Epoch 8/10
101/101 [==============================] - 4s - loss: 7.6164 - acc: 0.4455 - val_loss: 6.4477 - val_acc: 0.6000
Epoch 9/10
101/1[...]
{'fraction_non_alphanumeric': 0.248158379373849, 'fraction_numerical': 0.1270718232044199, 'mean_word_length': 4.198564593301436, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '290051', 'license': 'MIT', 'n_tokens_mistral': 1022, 'n_tokens_neox': 823, 'n_words': 185, 'path': 'nbs/lesson-1-mnist-hand-written-digits-with-vgg16.ipynb', 'repo_name': 'jasonody/deep-learning-1', 'size': '2172'}