资源简介
搬运的最新的2017 spring cs231n 课后编程作业,对学习深度学习很有用
代码片段和文件信息
from __future__ import print_function
from six.moves import cPickle as pickle
import numpy as np
import os
from scipy.misc import imread
import platform
def load_pickle(f):
version = platform.python_version_tuple()
if version[0] == ‘2‘:
return pickle.load(f)
elif version[0] == ‘3‘:
return pickle.load(f encoding=‘latin1‘)
raise ValueError(“invalid python version: {}“.format(version))
def load_CIFAR_batch(filename):
“““ load single batch of cifar “““
with open(filename ‘rb‘) as f:
datadict = load_pickle(f)
X = datadict[‘data‘]
Y = datadict[‘labels‘]
X = X.reshape(10000 3 32 32).transpose(0231).astype(“float“)
Y = np.array(Y)
return X Y
def load_CIFAR10(ROOT):
“““ load all of cifar “““
xs = []
ys = []
for b in range(16):
f = os.path.join(ROOT ‘data_batch_%d‘ % (b ))
X Y = load_CIFAR_batch(f)
xs.append(X)
ys.append(Y)
Xtr = np.concatenate(xs)
Ytr = np.concatenate(ys)
del X Y
Xte Yte = load_CIFAR_batch(os.path.join(ROOT ‘test_batch‘))
return Xtr Ytr Xte Yte
def get_CIFAR10_data(num_training=49000 num_validation=1000 num_test=1000
subtract_mean=True):
“““
Load the CIFAR-10 dataset from disk and perform preprocessing to prepare
it for classifiers. These are the same steps as we used for the SVM but
condensed to a single function.
“““
# Load the raw CIFAR-10 data
cifar10_dir = ‘cs231n/datasets/cifar-10-batches-py‘
X_train y_train X_test y_test = load_CIFAR10(cifar10_dir)
# Subsample the data
mask = list(range(num_training num_training + num_validation))
X_val = X_train[mask]
y_val = y_train[mask]
mask = list(range(num_training))
X_train = X_train[mask]
y_train = y_train[mask]
mask = list(range(num_test))
X_test = X_test[mask]
y_test = y_test[mask]
# Normalize the data: subtract the mean image
if subtract_mean:
mean_image = np.mean(X_train axis=0)
X_train -= mean_image
X_val -= mean_image
X_test -= mean_image
# Transpose so that channels come first
X_train = X_train.transpose(0 3 1 2).copy()
X_val = X_val.transpose(0 3 1 2).copy()
X_test = X_test.transpose(0 3 1 2).copy()
# Package data into a dictionary
return {
‘X_train‘: X_train ‘y_train‘: y_train
‘X_val‘: X_val ‘y_val‘: y_val
‘X_test‘: X_test ‘y_test‘: y_test
}
def load_tiny_imagenet(path dtype=np.float32 subtract_mean=True):
“““
Load TinyImageNet. Each of TinyImageNet-100-A TinyImageNet-100-B and
TinyImageNet-200 have the same directory structure so this can be used
to load any of them.
Inputs:
- path: String giving path to the directory to load.
- dtype: numpy datatype used to load the data.
- subtract_mean: Whether to subtract the mean training image.
Returns: A dictionary with the following entries:
- class_names: A list where class_na
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-09-11 17:26 CS231-master\
文件 2729 2017-09-11 17:26 CS231-master\README.md
文件 26 2017-09-11 17:26 CS231-master\_config.yml
目录 0 2017-09-11 17:26 CS231-master\assignment1\
文件 130 2017-09-11 17:26 CS231-master\assignment1\README.md
文件 2743 2017-09-11 17:26 CS231-master\assignment1\Unti
文件 169 2017-09-11 17:26 CS231-master\assignment1\collectSubmission.sh
目录 0 2017-09-11 17:26 CS231-master\assignment1\cs231n\
目录 0 2017-09-11 17:26 CS231-master\assignment1\cs231n\__pycache__\
文件 167 2017-09-11 17:26 CS231-master\assignment1\cs231n\__pycache__\__init__.cpython-36.pyc
文件 7083 2017-09-11 17:26 CS231-master\assignment1\cs231n\__pycache__\data_utils.cpython-36.pyc
文件 4401 2017-09-11 17:26 CS231-master\assignment1\cs231n\__pycache__\features.cpython-36.pyc
文件 3693 2017-09-11 17:26 CS231-master\assignment1\cs231n\__pycache__\gradient_check.cpython-36.pyc
文件 2328 2017-09-11 17:26 CS231-master\assignment1\cs231n\__pycache__\vis_utils.cpython-36.pyc
目录 0 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\
文件 103 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\__init__.py
目录 0 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\__pycache__\
文件 281 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\__pycache__\__init__.cpython-36.pyc
文件 4977 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\__pycache__\k_nearest_neighbor.cpython-36.pyc
文件 4234 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\__pycache__\linear_classifier.cpython-36.pyc
文件 2267 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\__pycache__\linear_svm.cpython-36.pyc
文件 6538 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\__pycache__\neural_net.cpython-36.pyc
文件 2269 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\__pycache__\softmax.cpython-36.pyc
文件 8250 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\k_nearest_neighbor.py
文件 6217 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\linear_classifier.py
文件 5312 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\linear_svm.py
文件 11183 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\neural_net.py
文件 3953 2017-09-11 17:26 CS231-master\assignment1\cs231n\classifiers\softmax.py
文件 7782 2017-09-11 17:26 CS231-master\assignment1\cs231n\data_utils.py
目录 0 2017-09-11 17:26 CS231-master\assignment1\cs231n\datasets\
文件 134 2017-09-11 17:26 CS231-master\assignment1\cs231n\datasets\get_datasets.sh
............此处省略132个文件信息
- 上一篇:node-v12.14.0-x64.rar
- 下一篇:中小型超市管理系统源码
相关资源
- 车牌_汉字_字母_数字训练集
- CycleGAN--应用于图像风格迁移
- 多篇深度学习,机器学习论文翻译,
- 机器学习-深度学习-NLP-算法工程师面
- deeplearning深度学习中文版无水印
- keras自带数据集的。。。
- 深度学习框架-PyTorch: 入门与实践(陈
- 雷达辐射源分选识别资料基于深度学
- 深度学习中word2vector测试语料text8
- 零基础入门深度学习-系列博客高清合
- Ian Goodfellow深度学习中文版+英文版
- Tensorflow - 实战Google深度学习框架 全本
- 深度学习方法及应用PDF高清晰完整版
- 《TensorFlow实战Google深度学习框架(第
- 深度学习与社会计算-刘知远
- 吴恩达深度学习专项课程编程作业集
- 《DeepLearning》深度学习圣经-IanGoodfe
- MNIST CNN 手写体识别完整数据集加代码
- Deep Reinforcement Learning Hands-On pdf
- 斯坦福大学深度学习课程课程讲义下
- 机器学习书籍大全
- 21个项目玩转深度学习
- Deep Learning 深度学习 bengio中文版
- 条形码VOC数据集,包括图片和标注文
- 深度学习花书配套代码
- Web安全之深度学习实战
- mnist四个数据集
- 《DeepLearning》深度学习圣经-IanGoodfe
- TensorFlow实战Google深度学习框架(第
- keras-segmentation-master.zip
评论
共有 条评论