problem

Traceback (most recent call last):
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line , in _do_call
return fn(*args)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line , in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line , in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.OutOfRangeError: RandomShuffleQueue '_0_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested , current size )
[[{{node shuffle_batch}}]] During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "test_TFRecord.py", line , in <module>
print(sess.run(label_batch))
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line , in run
run_metadata_ptr)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line , in _run
feed_dict_tensor, options, run_metadata)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line , in _do_run
run_metadata)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line , in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.OutOfRangeError: RandomShuffleQueue '_0_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested , current size )
[[node shuffle_batch (defined at test_TFRecord.py:) ]] Original stack trace for 'shuffle_batch':
File "test_TFRecord.py", line , in <module>
num_threads=)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line , in new_func
return func(*args, **kwargs)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/training/input.py", line , in shuffle_batch
name=name)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/training/input.py", line , in _shuffle_batch
dequeued = queue.dequeue_many(batch_size, name=name)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/ops/data_flow_ops.py", line , in dequeue_many
self._queue_ref, n=n, component_types=self._dtypes, name=name)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line , in queue_dequeue_many_v2
timeout_ms=timeout_ms, name=name)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py", line , in _apply_op_helper
op_def=op_def)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line , in new_func
return func(*args, **kwargs)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line , in create_op
op_def=op_def)
File "/home/xxx/anaconda3/envs/mtcnn_tfgpu/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line , in __init__
self._traceback = tf_stack.extract_stack()

code

# -*- coding: utf-8 -*-
"""
@author: friedhelm """
import tensorflow as tf
img_size = 12
filename_queue = tf.train.string_input_producer(["/home/xxx/workspace/test_code/github_test/MTCNN-tensorflow/version_1_0/DATA/12/neg_12_train.tfrecords"],shuffle=True,num_epochs=10) reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue) #返回文件名和文件 features = tf.parse_single_example(serialized_example,
features={
'img':tf.FixedLenFeature([],tf.string),
'label':tf.FixedLenFeature([],tf.int64),
'roi':tf.FixedLenFeature([4],tf.float32),
'landmark':tf.FixedLenFeature([10],tf.float32),
})
img=tf.decode_raw(features['img'],tf.uint8)
label=tf.cast(features['label'],tf.int64)
roi=tf.cast(features['roi'],tf.float32)
landmark=tf.cast(features['landmark'],tf.float32)
# img = tf.reshape(img, [48,48,3])
img = tf.reshape(img, [img_size,img_size,3])
# img=img_preprocess(img)
min_after_dequeue = 1000 #
batch_size = 10 #
capacity = min_after_dequeue + 10 * batch_size
image_batch, label_batch, roi_batch, landmark_batch = tf.train.shuffle_batch([img,label,roi,landmark],
batch_size=batch_size,
capacity=capacity,
min_after_dequeue=min_after_dequeue,
num_threads=7) i=0
with tf.Session() as sess:
sess.run((tf.global_variables_initializer(),
tf.local_variables_initializer()))
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess,coord=coord)
while(1):
i=i+1
if(i%9==1):
print(sess.run(label_batch))

why?

解决方法:详见here;

最新文章

  1. .net framework体系结构
  2. 利用ffmpeg给小视频结尾增加logo水印
  3. 百度Paddle会和Python一样,成为最流行的深度学习引擎吗?
  4. iOS:分割控制器UISplitViewcontroller
  5. android报错——The import android.util cannot be resolved
  6. PHP多维数组元素操作类
  7. 从壹开始微服务 [ DDD ] 之四 ║让你明白DDD的小故事 &amp; EFCore初探
  8. Nginx配置之负载均衡、限流、缓存、黑名单和灰度发布
  9. Druid密码加密
  10. Linux编程学习笔记(二)
  11. git diff 与git format-patch 生成补丁包
  12. android中Textview 和图片同时显示时,文字省略号显示,图片自动靠到右边
  13. Cubieboard A10 安装Nand系统,配置nginx,php,mysql,samba详细教程
  14. 使用googletest进行C++单元测试(Netbeans为例)
  15. iis 7上发布mvc报错:403.14-Forbidden Web 服务器被配置为不列出此目录的内容
  16. Python排序算法之直接插入排序
  17. php数据访问之查询关键字
  18. 【Linux系列】find命令使用
  19. visual studio 菜单栏显示异常 插件安装异常 扩展异常修复
  20. SSI整合 示例

热门文章

  1. Tensorflow简单实践系列(一):安装和运行
  2. php数组打乱顺序
  3. fitnesse wiki界面设置变量
  4. Classification and Decision Trees
  5. LeetCode 1102. Path With Maximum Minimum Value
  6. bootstrap轮播图组件
  7. CF468C 【Hack it!】
  8. NLP算法工程师(实习生)面试总结(持续更新)
  9. 【loj2263】【CTSC2017】游戏
  10. struct iphdr