yscacaca / DeepSense

Deepsense: a unified deep learning framework for time-series mobile sensing data processing.
196 stars 71 forks source link

Error executing tf.train.shuffle_batch #23

Open Samborce opened 6 years ago

Samborce commented 6 years ago

Hi,

Thank you very much for sharing your code. I downloaded your package and I tried to run it in Ubuntu 16.04 tf-1.1. I have received an error when the function tf.train.shuffle_batch is executed within the function input_line. The output error is:

Caused by op u'shuffle_batch', defined at: File "deepSense_HHAR_tf.py", line 215, in batch_feature, batch_label = input_pipeline(csvFileList, BATCH_SIZE) File "deepSense_HHAR_tf.py", line 64, in input_pipeline min_after_dequeue=min_after_dequeue) File "/vol/users/gzc/DeepSense/my_project/local/lib/python2.7/site-packages/tensorflow/python/training/input.py", line 1214, in shuffle_batch name=name) File "/vol/users/gzc/DeepSense/my_project/local/lib/python2.7/site-packages/tensorflow/python/training/input.py", line 784, in _shuffle_batch dequeued = queue.dequeue_many(batch_size, name=name) File "/vol/users/gzc/DeepSense/my_project/local/lib/python2.7/site-packages/tensorflow/python/ops/data_flow_ops.py", line 458, in dequeue_many self._queue_ref, n=n, component_types=self._dtypes, name=name) File "/vol/users/gzc/DeepSense/my_project/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 1328, in _queue_dequeue_many_v2 timeout_ms=timeout_ms, name=name) File "/vol/users/gzc/DeepSense/my_project/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 768, in apply_op op_def=op_def) File "/vol/users/gzc/DeepSense/my_project/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2336, in create_op original_op=self._default_original_op, op_def=op_def) File "/vol/users/gzc/DeepSense/my_project/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1228, in init self._traceback = _extract_stack()

OutOfRangeError (see above for traceback): RandomShuffleQueue '_1_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 64, current size 8) [[Node: shuffle_batch = QueueDequeueManyV2[component_types=[DT_FLOAT, DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]

Suggestions?

Thanking in advance.

Gabriel.

samre12 commented 6 years ago

@Samborce this error occurs when the queue reading elements into shuffle_batch queue reaches termination. The error is most probably due to this line. The string_input_producer function maintains a local counter to infinitely run over the string input tensor which must be initialised using local_variables_initializer as specified in the documentation. The code misses this portion. Try running the code with tf.local_variables_initializer() before this line.

mengchillee commented 6 years ago

@samre12 Hi, thank you very much for sharing your code, and I have faced the same issue too, but adding a local variables initializer didn't solve it. Could you give me some help?

Thank you!

Jeremy