-
大小:文件类型: .zip金币: 1下载: 0 次发布日期: 2023-07-21
- 语言: Python
- 标签: 深度学习 神经网络 deeplearning neuralnetwor 代码
资源简介
神经网络与深度学习-Neural Network and Deep Learning-Python3.5代码
代码片段和文件信息
“““expand_mnist.py
~~~~~~~~~~~~~~~~~~
Take the 50000 MNIST training images and create an expanded set of
250000 images by displacing each training image up down left and
right by one pixel. Save the resulting file to
../data/mnist_expanded.pkl.gz.
Note that this program is memory intensive and may not run on small
systems.
“““
from __future__ import print_function
#### Libraries
# Standard library
import cPickle
import gzip
import os.path
import random
# Third-party libraries
import numpy as np
print(“Expanding the MNIST training set“)
if os.path.exists(“../data/mnist_expanded.pkl.gz“):
print(“The expanded training set already exists. Exiting.“)
else:
f = gzip.open(“../data/mnist.pkl.gz“ ‘rb‘)
training_data validation_data test_data = cPickle.load(f)
f.close()
expanded_training_pairs = []
j = 0 # counter
for x y in zip(training_data[0] training_data[1]):
expanded_training_pairs.append((x y))
image = np.reshape(x (-1 28))
j += 1
if j % 1000 == 0: print(“Expanding image number“ j)
# iterate over data telling us the details of how to
# do the displacement
for d axis index_position index in [
(1 0 “first“ 0)
(-1 0 “first“ 27)
(1 1 “last“ 0)
(-1 1 “last“ 27)]:
new_img = np.roll(image d axis)
if index_position == “first“:
new_img[index :] = np.zeros(28)
else:
new_img[: index] = np.zeros(28)
expanded_training_pairs.append((np.reshape(new_img 784) y))
random.shuffle(expanded_training_pairs)
expanded_training_data = [list(d) for d in zip(*expanded_training_pairs)]
print(“Saving expanded data. This may take a few minutes.“)
f = gzip.open(“../data/mnist_expanded.pkl.gz“ “w“)
cPickle.dump((expanded_training_data validation_data test_data) f)
f.close()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-04-19 05:36 DeepLearningPython35-master\
文件 12 2018-04-19 05:36 DeepLearningPython35-master\.gitignore
文件 492526 2018-04-19 05:36 DeepLearningPython35-master\MyNetwork
文件 619 2018-04-19 05:36 DeepLearningPython35-master\README.md
文件 1982 2018-04-19 05:36 DeepLearningPython35-master\expand_mnist.py
文件 17051982 2018-04-19 05:36 DeepLearningPython35-master\mnist.pkl.gz
文件 2673 2018-04-19 05:36 DeepLearningPython35-master\mnist_average_darkness.py
文件 3425 2018-04-19 05:36 DeepLearningPython35-master\mnist_loader.py
文件 770 2018-04-19 05:36 DeepLearningPython35-master\mnist_svm.py
文件 6399 2018-04-19 05:36 DeepLearningPython35-master\network.py
文件 15252 2018-04-19 05:36 DeepLearningPython35-master\network2.py
文件 13000 2018-04-19 05:36 DeepLearningPython35-master\network3.py
文件 7394 2018-04-19 05:36 DeepLearningPython35-master\test.py
相关资源
- python深度学习(Chollet中文版)
- Deep_Learning_for_Computer_Vision_with_Python全
- 猫狗大战 深度学习 python代码
- 卷积神经网络的Python实现
- Python-20182019校招春招秋招算法NLP深度
- 深度学习入门:基于Python的理论与实
- 《深度学习入门:基于Python的理论与
- python深度学习项目:人脸识别库Face
- python深度学习.zip
- python深度学习
-
BeginningAnomalyDetectionUsingPython-ba
sedD - Python深度学习实战 基于tensorflow和k
-
深度学习风格迁移(st
yle transfer) - 卷积神经网络预测
- Python深度学习(中文版) 超清带书签
- numpy-1.15.3-cp27-none-win_amd64.whl
- Grokking Deep Learning 正式版pdf
- tensorflow-2.0.0-cp36-cp36m-win_amd64.whl
- 手写数字图像识别
- Python深度学习+2018中文版pdf+英文版p
- Python深度学习中文版
- Deep learning with python中文版
- 《neural networks and deep learning》《神经
- Python深度学习Deep Learning With Python中文
- tensorflow1.12.0及其依赖库离线安装包
- Keras快速上手基于Python的深度学习实战
- 机器学习scikit-learn 库
- 《深度学习入门:基于Python的理论与
- ENAS PyTorch高效神经网络结构搜索 项目
- python深度学习深度学习入门python.rar
评论
共有 条评论