In [1]:
from IPython.display import Image
Image('image/network_flowchart.png')
Out[1]:
In [2]:
%matplotlib inline
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
from sklearn.metrics import confusion_matrix
import time
from datetime import timedelta
import math
import os
import sys
sys.path.append('./utility')
download.maybe_download_and_extract(url=data_url, download_dir=data_path)
data_url = "https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz"
data_path = "data/CIFAR-10/"
In [3]:
import cifar10
cifar10.maybe_download_and_extract()
In [4]:
class_names = cifar10.load_class_names()
class_names
Out[4]:
In [5]:
images_train, cls_train, labels_train = cifar10.load_training_data()
In [6]:
print(images_train.shape)
print(labels_train.shape)
print(cls_train.shape)
In [7]:
images_test, cls_test, labels_test = cifar10.load_test_data()
print("Size of:")
print("- Training-set:\t\t{}".format(len(images_train)))
print("- Test-set:\t\t{}".format(len(images_test)))
In [8]:
import help_function as h
# Get the first images from the test-set.
images = images_test[0:9]
# Get the true classes for those images.
cls_true = cls_test[0:9]
# Plot the images and labels using our helper-function above.
h.plot_images(images=images, cls_true=cls_true, smooth=False)
In [9]:
from cifar10 import img_size, num_channels, num_classes
x = tf.placeholder(tf.float32, shape=[None, img_size, img_size, num_channels], name='x')
y_true = tf.placeholder(tf.float32, shape=[None, num_classes], name='y_true')
y_true_cls = tf.argmax(y_true, dimension=1)
is_training = tf.placeholder(tf.bool, name='is_training')
In [10]:
Image('image/network_flowchart.png')
Out[10]: