Session.run () / Tensor.eval () Tensorflow run for crazy long time

I am trying to learn tenforflow following the Convolutional Neural Networks tutorial, but when I tried to figure out how cifar10_input.py loads data from cifar-10-batches-bin , I ran into the problem that Tensor.eval() executing for a very long time or works forever without result. The code looks like this:

 import tensorflow as tf from tensorflow.models.image.cifar10 import cifar10_input filenames = ['/Users/me/Downloads/cifar-10-batches-bin/data_batch_1.bin'] filename_queue = tf.train.string_input_producer(filenames) read_input = cifar10_input.read_cifar10(filename_queue) reshaped_image = tf.cast(read_input.uint8image, tf.float32) with tf.Session() as sess: print reshaped_image.eval() 

The code is mainly from cifar10_input.py , and the data_batch_1.bin file is extracted from cifar-10-binary.tar.gz .

Usually I can observe the tensor using its eval() method. But in this case, it works continuously for a longer time than ever (I waited almost an hour, and it still worked). Is there something wrong in my code?

+5
source share
1 answer

1) As a basic health check: ls -al /Users/me/Downloads/cifar-10-batches-bin/data_batch_1.bin

2) Do not forget:

 init = tf.initialize_all_variables() sess.run(init) 

3) tf.train.start_queue_runners() (after creating the session)

This is probably # 3. string_input_producer adds the queue runner to the QUEUE_RUNNERS collection that needs to be run.

+6
source

Source: https://habr.com/ru/post/1238764/


All Articles