deeplearning.net/data/mnist/mnist.pkl.gz

  The MNIST dataset consists of handwritten digit images and it is divided in 60,000 examples
for the training set and 10,000 examples for testing. In many papers as well as in this tutorial,
the official training set of 60,000 is divided into an actual training set of 50,000 examples and
10,000 validation examples (for selecting hyper-parameters like learning rate and size of the
model). All digit images have been size-normalized and centered in a fixed size image of 28 x
28 pixels. In the original dataset each pixel of the image is represented by a value between 0
and 255, where 0 is black, 255 is white and anything in between is a different shade of grey.
  Here are some examples of MNIST digits:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAIAAAD9b0jDAAABuElEQVRIie3Ur4vycBzA8a8mGchY8RdYFBZEwaRRDEbZFoX5D2iy2BREcWAVwxeDyaAD2wSFlYFgEIsmMUywihNhTP0gF8Zz3ONx9/jslu7u/Qe8+P78IPTb98npdFJ/qlQqgiCMRiO/39/v9+/3u67r1Wr1KSgYDIbD4Xw+jzEeDAbwd6qqiqIIAKfTSVGUVCr1bzEejx8OB/ig6/XK8zzHcRzHJZNJmqafWiZFUZvN5sGazWaSJOm6rmnaU8r7GIbpdruFQsEUF4sFQRAIoUgkgjG2iCKE3G43QghjDAC5XM469L5WqwUAsiw7HA7bUIIgZFkGgEwmYxuKEAqFQpqmqara6/WKxaJtLsuyx+PRvLRyuezz+exxo9HoZDIx3U6nEwgE7HFJkuR5/na7AcB0OrUHNTMMAwAMw3jqd35eLBar1Wrj8dg8geVy+aVHRtN0u93e7/evX/ZyuUiSZJHzer2lUmm73b4dAvP5PJvNWuE8Hk86nV6v1w8zhWVZK7umKGo4HD5MKUVRGIZxuVz/zSUSCVEUd7vdW+58PjcaDXNEWUkQhFdrtVo1m816vU6SpEXup/YC+WlArfd1WoMAAAAASUVORK5CYII=" alt="" />aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAIAAAD9b0jDAAAB1UlEQVRIie3UravqYBwH8FMcyJqcMJhRq8OBOBCMCwqWzeyfIGuaRIPJoNgHypjFMpugxaFgshnn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huqqupsNgMwHo+l//3X7mAwAOBns7/MF5RoDnCMHLPMAAAAAElFTkSuQmCC" alt="" />aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAIAAAD9b0jDAAAB/klEQVRIie2TP8hpYRzHnw5HKX8LUUgo6xmOAQsTAysGZbAwmBiOEBObsrCYDOqUhaPMJpEoC6Uoik3nIMvvpDuc7ptFXd673Nv7mZ7n1/P79Pz7IvTDf4hMJtPr9YlEIpfLSSSS7+osFkuj0VgsFvCber3+uc7hcDSbzev1CgA8z+92u+VyCQCn08nhcLytUygUzWbzfD5/7W61WpnNZrvdLkw9Hs/b0ng8Dk+s12uj0YgQ+pZ0MBgIzZvNptPpmEwmoR4MBj+XGgyGUqnkcrm0Wu1zPZFIfC59RavV+jvSdDpNUVQul6MoajKZAMBoNMIw7BOXVColSbLf7/M8z/P84/EQBofDwWq1vq0Ti8VOp3O/3wPA5XI5HA40TXMcJxz8eDxms1kcx98w4jgeCoWE/kKh4Ha7EUJqtfo5UQAQDof/NKxisbhSqQhtDMMolUqEkEajmU6nPM/f7/dyudztdoUFw+HQ5/MRBEEQxEsjhmHVahUAWJZNpVIqlQohRJLkeDwWEuX1ehFCcrnc7/e3222WZQX7drt9KU0mkwDAcVwkElGr1YFAgKZpIfjFYlFI1DPRaJRhGIZh7Hb7S+nxeASA2+02m81Wq9XX9eXz+Q8/EEJoPp8/P0Wv18tkMjabTSQSfWhECMlkslgsVqvVKIrS6XTvfZof/jF+AdReWL8sdEZ6AAAAAElFTkSuQmCC" alt="" />
  For convenience we pickled the dataset to make it easier to use in python. It is available for
download here. The pickled file represents a tuple of 3 lists : the training set, the validation
set and the testing set. Each of the three lists is a pair formed from a list of images and a list
of class labels for each of the images. An image is represented as numpy 1-dimensional array

of 784 (28 x 28) float values between 0 and 1 (0 stands for black, 1 for white). The labels are
numbers between 0 and 9 indicating which digit the image represents. The code block below
shows how to load the dataset.

import cPickle, gzip, numpy
# Load the dataset
f = gzip.open(’mnist.pkl.gz’, ’rb’)
train_set, valid_set, test_set = cPickle.load(f)
f.close()

  When using the dataset, we usually divide it in minibatches (see Stochastic Gradient Descent).
We encourage you to store the dataset into shared variables and access it based on the minibatch
index, given a fixed and known batch size. The reason behind shared variables is related to
using the GPU. There is a large overhead when copying data into the GPU memory. If you
would copy data on request ( each minibatch individually when needed) as the code will do if
you do not use shared variables, due to this overhead, the GPU code will not be much faster
then the CPU code (maybe even slower). If you have your data in Theano shared variables
though, you give Theano the possibility to copy the entire data on the GPU in a single call
when the shared variables are constructed. Afterwards the GPU can access any minibatch by
taking a slice from this shared variables, without needing to copy any information from the
CPU memory and therefore bypassing the overhead. Because the datapoints and their labels
are usually of different nature (labels are usually integers while datapoints are real numbers) we
suggest to use different variables for labes and data. Also we recomand using different variables
for the training set, validation set and testing set to make the code more readable (resulting in 6
different shared variables).
  Since now the data is in one variable, and a minibatch is defined as a slice of that variable,
it comes more natural to define a minibatch by indicating its index and its size. In our setup
the batch size stays constant through out the execution of the code, therefore a function will
actually require only the index to identify on which datapoints to work. The code below shows
how to store your data and how to access a minibatch:

def shared_dataset(data_xy):
  """ Function that loads the dataset into shared variables
  The reason we store our dataset in shared variables is to allow
  Theano to copy it into the GPU memory (when code is run on GPU).
  Since copying data into the GPU is slow, copying a minibatch everytime
  is needed (the default behaviour if the data is not in a shared
  variable) would lead to a large decrease in performance.
  """
  data_x, data_y = data_xy
  shared_x = theano.shared(numpy.asarray(data_x, dtype=theano.config.floatX))
  shared_y = theano.shared(numpy.asarray(data_y, dtype=theano.config.floatX))
  # When storing data on the GPU it has to be stored as floats
  # therefore we will store the labels as ‘‘floatX‘‘ as well
  # (‘‘shared_y‘‘ does exactly that). But during our computations
  # we need them as ints (we use labels as index, and if they are
  # floats it doesn’t make sense) therefore instead of returning
  # ‘‘shared_y‘‘ we will have to cast it to int. This little hack
  # lets us get around this issue
  return shared_x, T.cast(shared_y, ’int32’)
test_set_x, test_set_y = shared_dataset(test_set)
valid_set_x, valid_set_y = shared_dataset(valid_set)
train_set_x, train_set_y = shared_dataset(train_set)
batch_size = 500 # size of the minibatch
# accessing the third minibatch of the training set
data = train_set_x[2 * 500: 3 * 500]
label = train_set_y[2 * 500: 3 * 500]

   The data has to be stored as floats on the GPU ( the right dtype for storing on the GPU is given by
theano.config.floatX). To get around this shortcomming for the labels, we store them as float, and
then cast it to int.

----------------------------------------------------------------------------------------------------------------
Note: If you are running your code on the GPU and the dataset you are using is too large to fit in memory
the code will crash. In such a case you should store the data in a shared variable. You can however store a
sufficiently small chunk of your data (several minibatches) in a shared variable and use that during training.
Once you got through the chunk, update the values it stores. This way you minimize the number of data
transfers between CPU memory and GPU memory.

----------------------------------------------------------------------------------------------------------------

资料:mnist.pkl.gz数据包的下载以及数据内容解释的更多相关文章

  1. python+fiddler 抓取抖音数据包并下载抖音视频

    这个我们要下载视频,那么肯定首先去找抖音视频的url地址,那么这个地址肯定在json格式的数据包中,所以我们就去专门查看json格式数据包 这个怎么找我就不用了,直接看结果吧 你找json包,可以选大 ...

  2. 用R包来下载sra数据

    1)介绍 我们用SRAdb library来对SRA数据进行处理. SRAdb 可以更方便更快的接入  metadata associated with submission, 包括study, sa ...

  3. C#开发BIMFACE系列46 服务端API之离线数据包下载及结构详解

    BIMFACE二次开发系列目录     [已更新最新开发文章,点击查看详细] 在前一篇博客<C#开发BIMFACE系列45 服务端API之创建离线数据包>中通过调用接口成功的创建一个离线数 ...

  4. IM通信协议逆向分析、Wireshark自定义数据包格式解析插件编程学习

    相关学习资料 http://hi.baidu.com/hucyuansheng/item/bf2bfddefd1ee70ad68ed04d http://en.wikipedia.org/wiki/I ...

  5. Windows下底层数据包发送实战

    1.简介 所谓“底层数据包”指的是在“运行”于数据链路层的数据包,简单的说就是“以太网帧”,而我们常用的Socket只能发送“运行”在传输层的TCP.UDP等包,这些传输层数据包已经能满足绝大部分需求 ...

  6. sk_buff封装和解封装网络数据包的过程详解(转载)

    http://dog250.blog.51cto.com/2466061/1612791 可以说sk_buff结构体是Linux网络协议栈的核心中的核心,几乎所有的操作都是围绕sk_buff这个结构体 ...

  7. C# 实现的多线程异步Socket数据包接收器框架

    转载自Csdn : http://blog.csdn.net/jubao_liang/article/details/4005438 几天前在博问中看到一个C# Socket问题,就想到笔者2004年 ...

  8. 史上最全最强Charles截取手机https协议数据包教程(附上利用此技术制作最近微信比较火的头脑王者辅助外挂)!

    纯原创,思路也是本人花了半个小时整理出来的,整个完成花费了本人半天时间,由于不才刚大学毕业,所以有的编码方面可能不入大牛们的眼,敬请原谅!如有转载请附上本地址,谢谢! 最近微信朋友圈刚刚被跳一跳血洗, ...

  9. Linux 中的网络数据包捕获

    Linux 中的网络数据包捕获 Ashish Chaurasia, 工程师 简介: 本教程介绍了捕获和操纵数据包的不同机制.安全应用程序,如 VPN.防火墙和嗅探器,以及网络应用程序,如路由程序,都依 ...

随机推荐

  1. word excel文件 存入数据库 实战

    上传: private void Insert2017(HttpContext context) { if (context.Request.Files["fileword"].C ...

  2. Spark源代码阅读笔记之MetadataCleaner

    MetadataCleaner执行定时任务周期性的清理元数据(metadata),有6种类型的元数据:MAP_OUTPUT_TRACKER.executor跟踪各个map任务输出的存储位置的数据,依据 ...

  3. iOS各种问题处理

    本文转载至:http://www.cnblogs.com/ygm900/category/436923.html 推荐初学者前去学习.     mac 拷贝文件时报错 8060 解决方案 摘要: 解决 ...

  4. JSP页面的生命周期

    JSP页面的生命周期:我们假设要访问的jsp页面是index.jsp.首先,用户发出请求index.jsp:服务器会判断是否是第一次请求:如果是的话,JSP引擎会把该JSP文件转换成为一个Servle ...

  5. [Wc2007]剪刀石头布[补集转化+拆边]

    2597: [Wc2007]剪刀石头布 Time Limit: 20 Sec  Memory Limit: 128 MBSec  Special JudgeSubmit: 1157  Solved:  ...

  6. Thymeleaf模板如何获取springMVC返回的model值

    Thymeleaf模板如何获取springMVC返回的model值 后台的实现: @RequestMapping("/hello") public String hello(Mod ...

  7. Zabbix监控web,MySQL,TCP状态,Nginx

    接上篇Zabbix使用SMTP发送邮件报警并且制定报警内容 Zabbix怎么设置声音告警 web监控 在zabbix server选择web 创建一个监控web的场景 添加后这里有数字1 查看 假如在 ...

  8. Orchard 与 ABP架构比较 (aspnetboilerplate)

    前言:  ABP框架经常在一些.NET群中听群友提起,以前也浏览过官网,大致了解它是一个框架,直到今天本人才正式下载源码入门 ... 经过两个小时的ABP中文文档入门(感谢各位辛勤的翻译者) ,大致了 ...

  9. 修改计算机名后SQLServer无法使用windows账号登录

    USE master     GO    EXEC sp_configure'allow updates',1 RECONFIGURE WITH OVERRIDE   -- 设置两个变量    DEC ...

  10. python web框架 Django 登录页面

    在django 项目下 创建一个templates 放模板的文件夹 html文件都放在这里 在里面写一个login.html 登录页面 urls.py 加上 login 对应关系 from djang ...