一、Deeplearning-assignment
在本次作业中,我们将学习如何通过tensorflow框架实现一个简单的卷积神经网络。
现在有一个数据集,对应着6张图片的数据:
我们将通过tensorflow做出一个卷积模型,并通过它对数据集进行训练,提高其在测试集上的准确率。
以下是tensorflow model的步骤:
- 创建createholders
- 对参数进行初始化
- 实现前向传播
- 计算cost
- 创建一个优化器对cost进行梯度下降算法
二、相关算法代码
import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import scipy
from PIL import Image
from scipy import ndimage
import tensorflow as tf
from tensorflow.python.framework import ops
from week1.cnn_utils import *
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
np.random.seed(1)
X_train_orig, Y_train_orig, X_test_orig, Y_test_orig, classes = load_dataset()
# index = 15
# plt.imshow(X_train_orig[index])
# print("y = " + str(np.squeeze(Y_train_orig[:, in