神经网络与深度学习编程练习(coursera 吴恩达 )(3)

本文档介绍了如何使用神经网络进行多层深度学习,以识别图像中的猫。通过在Coursera课程的基础上完成编程练习,实现了完整的神经网络模型。训练过程中,随着迭代次数增加,损失函数(cost)逐渐减小,表明模型性能提升。同时,文章展示了测试集中部分识别错误的图像,并提供了自我测试图片的方法。
摘要由CSDN通过智能技术生成

完整实现多层神经网络识别图片中的猫
coursera课程主页,在网易云课堂中也有课程资源不过没有编程练习。
本次编程利用上次作业中完成的各个函数,完整实现一个多层神经网络,进过训练来识别图片中是否有猫。
代码及训练测试数据下载
代码中没注释,不过coursera里的解释很详细。

import time
import numpy as np 
import h5py
import matplotlib.pyplot as plt 
import scipy 
from PIL import Image
from scipy import ndimage
from dnn_app_utils_v2 import *

plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'

np.random.seed(1)

train_x_orig,train_y,test_x_orig,test_y,classes=load_dataset()
'''
index=11
plt.imshow(train_x_orig[index])
print('y='+str(train_y[0,index])+",It's a "+classes[train_y[0,index]].decode('utf-8')+' picture.')

plt.show()
'''
m_train=train_x_orig.shape[0]
num_px=train_x_orig.shape[1]
m_test=test_x_orig.shape[0]

print ("Number of training examples: " + str(m_train))
  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值