在Tensorflow中使用大型数据集 [英] Use large dataset in Tensorflow

查看:368
本文介绍了在Tensorflow中使用大型数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想训练一个具有大数据集的CNN.目前,我将所有数据加载到tf.constant中,然后在tf.Session()中以较小的Batch大小循环遍历它.对于一小部分数据集来说,这很好用,但是当我增加输入大小时,我得到了错误:

I would like to train a CNN with a large dataset. Currently I load all data into tf.constant and then loop through it with a small Batch size in tf.Session(). That works fine for a small fraction of the dataset, but when I increase the input size I get the error:

ValueError: Cannot create a tensor proto whose content is larger than 2GB.

如何避免这种情况?

推荐答案

请勿将数据加载到常量,它将成为您的计算图的一部分.

Do not load data to constant, it will be part of your computational graph.

您应该宁愿:

  • 创建一个以流方式加载数据的操作
  • 在python部分中加载数据,并使用feed_dict将批处理传递到图形中

这篇关于在Tensorflow中使用大型数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆