python卷积神经网络库_GitHub - thesouther/cnn_with_numpy: 卷积神经网络(Convolutional Neural Networks, CNN),只使用pyth...

基于python基础库实现卷积神经网络LeNet5

卷积神经网络(Convolutional Neural Networks, CNN),只使用python基础库搭建。

本程序实现为ipynb和py脚本两种,ipynb文件更加易读,所以建议阅读CNNwithNumpy.ipynb文件

简介

本程序只基于Python的numpy库,实现cnn网络Lenet5,并用于在MNIST数据集上进行手写字符识别。

本程序实现了convolution、relu、max_pooling、fc、softmax等层级的前向和后向算法,并在mnist数据集的测试集上在3个epoch就可以实现98% 以上的的准确率。训练时间大概一个小时。

运行与查看

为了方便,本人整理了了notebook形式的文件,记录了运行过程中的中间结果,你可以查看完整版CNN.ipynb文件,或者直接从我的github方便地查看效果。

python文件。进行训练和测试,运行

python run.py

文件目录说明

文件目录树如下:

.

|-- data

| |-- t10k-images-idx3-ubyte.gz # mnist测试数据

| |-- t10k-labels-idx1-ubyte.gz # mnist测试标签

| |-- train-images-idx3-ubyte.gz # mnist训练数据

| `-- train-labels-idx1-ubyte.gz # mnist训练标签

|-- layer

| |-- Convolution.py # 卷积层

| |-- Relu.py # Relu激活函数

| |-- Softmax.py # softmax层

| |-- flatten.py # 将二维数据展开成一维

| |-- full_connection.py #全连接层

| `-- max_pool.py # 池化层

|-- data_helper.py # 载入数据

|-- CNN.py # CNN模型定义类

|-- run.py # 训练和测试代码

|-- 完整版CNN.ipynb # 完整的CNN代码,可以方便查看

|-- README.md

运行环境

python = 3.6.10

numpy = 1.16.0

Reference

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
LazyProgrammer, "Convolutional Neural Networks in Python: Master Data Science and Machine Learning with Modern Deep Learning in Python, Theano, and TensorFlow" 2016 | ASIN: B01FQDREOK | 52 pages | EPUB | 1 MB This is the 3rd part in my Data Science and Machine Learning series on Deep Learning in Python. At this point, you already know a lot about neural networks and deep learning, including not just the basics like backpropagation, but how to improve it using modern techniques like momentum and adaptive learning rates. You've already written deep neural networks in Theano and TensorFlow, and you know how to run code using the GPU. This book is all about how to use deep learning for computer vision using convolutional neural networks. These are the state of the art when it comes to image classification and they beat vanilla deep networks at tasks like MNIST. In this course we are going to up the ante and look at the StreetView House Number (SVHN) dataset - which uses larger color images at various angles - so things are going to get tougher both computationally and in terms of the difficulty of the classification task. But we will show that convolutional neural networks, or CNNs, are capable of handling the challenge! Because convolution is such a central part of this type of neural network, we are going to go in-depth on this topic. It has more applications than you might imagine, such as modeling artificial organs like the pancreas and the heart. I'm going to show you how to build convolutional filters that can be applied to audio, like the echo effect, and I'm going to show you how to build filters for image effects, like the Gaussian blur and edge detection. After describing the architecture of a convolutional neural network, we will jump straight into code, and I will show you how to extend the deep neural networks we built last time with just a few new functions to turn them into CNNs. We will then test their performance and show how convolutional neu

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值