mnist

Can't load 'mnist-original' dataset using sklearn

情到浓时终转凉″ 提交于 2019-12-04 19:56:15
This question is similar to what asked here and here . Unfortunately, in my case the suggested solution didn't fix the problem. I need to work with the MNIST dataset but I can't fetch it, even if I specify the address of the scikit_learn_data/mldata/ folder (see below). How can I fix this? In case it might help, I'm using Anaconda. Code: from sklearn.datasets.mldata import fetch_mldata dataset = fetch_mldata('mnist-original', data_home='/Users/michelangelo/scikit_learn_data/mldata/') mnist = fetch_mldata('MNIST original') Error: -----------------------------------------------------------------

How can I read the MNIST dataset with C++?

一曲冷凌霜 提交于 2019-12-04 17:37:39
I was reading the following question: How to read MNIST data in C++? and there was some C++ code for reading the MNIST database. Upon trying it I found out that it worked fine until the place where it started reading the data. which is the following code: for(int i=0;i<number_of_images;++i) { for(int r=0;r<n_rows;++r) { for(int c=0;c<n_cols;++c) { unsigned char temp=0; file.read((char*)&temp,sizeof(temp)); //cout<<(int)temp<<" "; //printing the pixel in integer format } } } I tried printing out the integer value of the variable "temp" however I didn't get the correct number for the pixels(all

python pickle UnicodeDecodeError

徘徊边缘 提交于 2019-12-04 10:26:38
问题 I'm trying to load the mnist character dataset (following the tutorial outlined here: http://neuralnetworksanddeeplearning.com/chap1.html ) when I run the load_data_wrapper function I get the error. UnicodeDecodeError: 'ascii' codec can't decode byte 0x90 in position 614: ordinal not in range(128) The code run is: import numpy as np import gzip def load_data(): f = gzip.open('../data/mnist.pkl.gz', 'rb') training_data, validation_data, test_data = pickle.load(f) f.close() return (training

caffe在docker环境中使用GPU

一世执手 提交于 2019-12-04 08:36:50
1.Prerequisites 2.nvidia-docker2 参考这里https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(version-2.0) 按照步骤来就行. 3.检查以上是否安装正确 3.1 主机是否能正常显示GPU信息 4.pull一个镜像 这里作为试验 就直接从网上pull 了一个,如果你要自己定制,你需要去了解Docker 相关的知识。 nvidia-docker run -ti bvlc/caffe:gpu caffe --version #关于如何加速下载,网上有很多的 daocloud 的只要运行一个脚本就行 5.运行刚才下载的镜像 dl_test_1:latest 是我自己命名的 ,这里有一个端口映射,我将Container 里面的ssh 服务映射到了50005号端口,所以可以通过50005号端口访问Container。 -v 用于挂载主机的目录,这样容器和主机就可以进行文件交换。 6.容器中运行caffe示例 首先进入caffe 目录。这个是在/opt/caffe 6.1运行以下命令 ./data/mnist/get_mnist.sh ./examples/mnist/create_mnist.sh 在CPU模式下运行 root@72f016eb6fce:/opt/caffe# .

docker简单操作,以及运行gpu

人走茶凉 提交于 2019-12-04 08:29:59
最近正在做关于gpu的运行相关的工作。所以本篇文章所写的都是本人经过真实操作的,并非网络版本的copy,这个也是增加积累以及分享。 先说下我最近的目的,希望训练模型可以运行在cpu以及gpu上,由于gpu运行速度较快,所以在机器学习中,计算资源的考虑必不可少,其实我的最终目标是使用kubernetes集群来管理运行基于tensorflow的模型训练任务。由于目前k8s运行gpu还没有实际跑通,所以最近一直比较苦恼,若是有大神能指导下,感谢之至。 好的,下面来说如何在docker中运行gpu。 先简单介绍下docker的基本使用。下面我就完全以我的操作来说明。 首先下载需要的image,我是需要下载Google tensorflow的cpu版本,当然docker hub上基本都有常用的image,所以如果机器直接可访问外网,那么直接 docker pull tensorflow:tensorflow 如果无法访问外网,那么你需要通过其他方式下载,完了save镜像成为一个tar包,然后copy到你的环境中,进行load即可。下载image后,为了整个集群的各个node节点都可用,可以push到私有仓库即可。具体如下: docker tag tensorflow:tensorflow 27.10.0.101:5000/tensorflow:v1 docker push 27.10.0

caffe中参数设置的解析

自闭症网瘾萝莉.ら 提交于 2019-12-04 06:07:00
lenet_solver.prototxt: net: "examples/mnist/lenet_train_test.prototxt" test_iter: 100 test_interval: 500 base_lr: 0.01 momentum: 0.9 type: SGD weight_decay: 0.0005 lr_policy: "inv" gamma: 0.0001 power: 0.75 display: 100 max_iter: 20000 snapshot: 5000 snapshot_prefix: "examples/mnist/lenet" solver_mode: CPU net :网络模型(训练网络模型、测试网络模型) test_iter :测试的批次数,这个参数要与batch_size结合起来理解,例如:mnist数据集中测试样本总数为10000,一次执行全部数据效率很低,因此,我们将测试数据分几个批次来执行。假定我们设置batch_size为100,则需要迭代100次才能将10000个数据全部执行完,因此,将test_iter设置为100。执行完一次全部数据,称之为一个epoch test_iterval :测试间隔,每训练500次进行一次测试 base_lr: 0.01 lr_policy: "inv" gamma: 0.0001

Docker使用tensorflow serving部署mnist模型

橙三吉。 提交于 2019-12-04 03:43:53
参考: 1、 https://tensorflow.google.cn/serving/serving_inception 2、 https://tensorflow.google.cn/serving/serving_basic 主机安装tensorflow serving 参考 这里 主机使用tensorflow serving部署mnist模型参考 这里 Docker安装tensorflow serving 参考 这里 Docker中部署Inception模型 参考 这里 1、创建一个Docker镜像 参考:Docker安装tensorflow serving 参考 这里 运行容器 docker pull registry.cn-hangzhou.aliyuncs.com/ 781708249 /tensorflow-serving:v1 # 已经配置好的tensorflow serving 从阿里镜像拉下来 git clone --recurse-submodules https://github.com/tensorflow/serving # serving下载到主机上 docker run --name=mnist_container -it -v /home/wu/serving:/serving registry.cn-hangzhou.aliyuncs.com/

TF_Serving 部署一个模型

我只是一个虾纸丫 提交于 2019-12-04 03:43:15
参考: 1、 https://tensorflow.google.cn/ 2、 https://www.tensorflow.org/ 3、 http://note.youdao.com/noteshare?id=92af08c5ceff28db9748f822fee05322&sub=7E5B724B2443405C9DD3D8E22C3A1EE9 TF_Serving安装参考: http://blog.csdn.net/wc781708249/article/details/78594750 本教程将向您介绍如何使用TensorFlow Serving组件导出经过训练的TensorFlow模型,并使用标准tensorflow_model_server来提供它。 如果您已经熟悉TensorFlow Serving,并且您想了解更多有关服务器内部工作方式的信息,请参阅 TensorFlow Serving高级教程 。 本教程使用TensorFlow教程中介绍的简单Softmax回归模型进行手写图像(MNIST数据)分类。 如果您不知道TensorFlow或MNIST是什么,请参阅 MNIST For ML Beginners教程 。 本教程的代码由两部分组成: 训练并导出模型的Python文件 mnist_saved_model.py 。 ModelServer二进制文件

Tensorflow 2.0 datasets数据加载

非 Y 不嫁゛ 提交于 2019-12-03 23:34:46
导入包 import tensorflow as tf from tensorflow import keras 加载数据 tensorflow可以调用keras自带的datasets,很方便,就是有一点让人不爽的是下载需要fq,而这个代理不太方便开,所以这里我把所有数据都下载下来了,并上传到了坚果云,方便大家下载。 下载连接 (访问密码:yDmqHd) 下载好之后,把输入放入 C:\Users\用户名\.keras\datasets 里面,如果没有 datasets 文件夹,就新建一个,然后直接把数据放里面就行了。 目录结构如下 C:. │ keras.json │ └─datasets │ boston_housing.npz │ cifar-10-batches-py.tar.gz │ cifar-100-python.tar.gz │ imdb.npz │ mnist.npz │ reuters.npz │ └─fashion-mnist t10k-images-idx3-ubyte.gz t10k-labels-idx1-ubyte.gz train-images-idx3-ubyte.gz train-labels-idx1-ubyte.gz 最后读入数据只需一句话 (x, y), (x_test, y_test) = keras.datasets.mnist.load

What is the structure of torch dataset?

非 Y 不嫁゛ 提交于 2019-12-03 20:17:11
I am beginning to use torch 7 and I want to make my dataset for classification. I've already made pixel images and corresponding labels. However, I do not know how to feed those data to the torch. I read some codes from others and found out that they are using the dataset whose extension is '.t7' and I think it is a tensor type. Is it right? And I wonder how I can convert my pixel images(actually, I made them with Matlab by using MNIST dataset) into t7 extension compatible to the torch. There must be structure of dataset in the t7 format but I cannot find it (also for the labels too). To sum