赞
踩
转自知乎:使用tensorflow导入手动下载好的mnist数据集https://zhuanlan.zhihu.com/p/133402910
方法一:
数据源:
https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npzstorage.googleapis.com
- import tensorflow as tf
- import numpy as np
- def load_data(path):
- with np.load(path) as f:
- x_train, y_train = f['x_train'], f['y_train']
- x_test, y_test = f['x_test'], f['y_test']
- return (x_train, y_train), (x_test, y_test)
-
- (x_train, y_train),(x_test, y_test) = load_data(path="./keras/mnist.npz")#mnist的本地路径
me的代码路径,C:\... \code\tf2_cmd.ipynb,手动数据集路径C:\...\code\keras\mnist.npz
方法二:
from mymnist import input_data mnist= input_data.read_data_sets("MNIST_data/", one_hot=True)
这个方法需要下载重写的input_data.py
https://pan.baidu.com/s/1jSV226h9DXAhJNnrRY_xBgpan.baidu.com
mymnist文件夹下放MNIST_data文件夹和input_data.py文件,在MNIST__data文件夹下放下载好的文件
发布于 2020-04-19
me运行mnist数据集的效果
me真正想要的是Fashion-mnist数据集,它的手动下载并安装方法见(二)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。