Skip to content

Commit

Permalink
Add project 4 utils
Browse files Browse the repository at this point in the history
  • Loading branch information
CihanSoylu committed Mar 6, 2020
1 parent 94cfd56 commit fbea596
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions project_utils/project_4_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import tensorflow as tf
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

CLASS_NAMES = [ 'T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']

def load_data():

(x_train, y_train), (x_val, y_val) = tf.keras.datasets.fashion_mnist.load_data()

x_train = x_train/255.
x_val = x_val/255.

return x_train, x_test, y_train, y_test

def plot_data(images, labels):

images = images * 255.
n = len(images)

plt.figure(figsize=(10*n,15))
for i in range(n):
plt.subplot(n,1,i+1)
plt.imshow(images[i].reshape((28,28)), cmap=plt.cm.gray)
plt.title(CLASS_NAMES[labels[i]])

0 comments on commit fbea596

Please sign in to comment.