import time
import numpy as np
import h5py
import matplotlib.pyplot as plt
import scipy
from PIL import Image
from scipy import ndimage
from m2_uits import *%matplotlib inline
plt.rcParams['figure.figsize']=(5.0,4.0) # set default size of plots
plt.rcParams['image.interpolation']='nearest'
plt.rcParams['image.cmap']='gray'%load_ext autoreload
%autoreload 2
np.random.seed(1)
#Loading the data(cat/non-cat)
train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes =load_dataset()
#查看数据集大小
m_train = train_set_x_orig.shape[0]
m_test = test_set_x_orig.shape[0]
num_px = train_set_x_orig.shape[1]print("Number of training examples: m_train = "+str(m_train))print("Number of testing examples: m_test = "+str(m_test))print("Height/Width of each image: num_px = "+str(num_px))print("Each image is of size: ("+str(num_px)+", "+str(num_px)+", 3)")print("train_set_x shape: "+str(train_set_x_orig.shape))print("train_set_y shape: "+str(train_set_y.shape))print("test_set_x shape: "+str(test_set_x_orig.shape))print("test_set_y shape: "+str(test_set_y.shape))
# 对数据集回炉重造--测试集和训练集
train_set_x_flatten = train_set_x_orig.reshape(train_set_x_orig.shape[0],-1).T # The "-1" makes reshape flatten the remaining dimensions
test_set_x_flatten = test_set_x_orig.reshape(test_set_x_orig.shape[0],-1).T
# 标准化
train_set_x = train_set_x_flatten/255.
test_set_x = test_set_x_flatten/255.
#12288=64*64*3print("train_set_x's shape: "+str(train_set_x.shape))print("test_set_x's shape: "+str(test_set_x.shape))