Skip to content

Instantly share code, notes, and snippets.

@ImadDabbura
Created September 20, 2018 15:24
Show Gist options
  • Save ImadDabbura/3921b47d0e07727d75334c2cd407abfb to your computer and use it in GitHub Desktop.
Save ImadDabbura/3921b47d0e07727d75334c2cd407abfb to your computer and use it in GitHub Desktop.
# Loading packages
import sys
import h5py
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sys.path.append("../scripts/")
from coding_neural_network_from_scratch import (L_model_forward,
compute_cost,
L_model_backward,
update_parameters,
accuracy)
from load_dataset import load_dataset_catvsdog
%matplotlib inline
sns.set_context("notebook")
plt.style.use("fivethirtyeight")
X, Y = load_dataset_catvsdog("../data")
# show a sample of of a cat and a dog image
index_cat = np.argmax(Y); index_dog = np.argmin(Y)
plt.subplot(1, 2, 1)
plt.imshow(X[:, index_cat].reshape(150, 150, 3))
plt.axis("off")
plt.subplot(1, 2, 2)
plt.imshow(X[:, index_dog].reshape(150, 150, 3))
plt.axis("off");
# standarize the data
X = X / 255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment