0

Tensorboard graph

I'm running this code to classify house numbers from Google Streetview, it runs and then goes into some sort of loop in the first step, I don't know why.

I have narrowed down the problem to be from the input pipeline.

def convert_labels(labels):
    for i in range(len(labels)):
        if len(labels[i])==2:
            labels[i].append(10)
        elif len(labels[i])==1:
            labels[i].append(10)
            labels[i].append(10)
    return labels

with open('whole_data.pickle','rb') as f:
    data_obj=pickle.load(f)
train_images=np.asarray(data_obj['train_data'][0],np.float32)
train_labels=np.asarray(convert_labels(data_obj['train_data'][1]),np.int32)
whole_train=[train_images,train_labels]
whole_train[0]=np.reshape(whole_train[0][:],[whole_train[0].shape[0],32,32,1])

graph = tf.Graph()

with graph.as_default():
    with tf.name_scope('Pipelines'):
        image_batch,label_batch=tf.train.shuffle_batch([whole_train[0],
        batch_size=64,capacity=50000,enqueue_many=True,min_after_dequeue=100,
        name='train_pipe')


with tf.Session(graph=graph) as sess:
tf.global_variables_initializer().run()
writer=tf.summary.FileWriter('/tmp/Mark2_logs',graph=graph)
step=1 
print('hi')
for step in range(100): 
    print('step %d' %(step))
    batch_images,batch_labels=sess.run([image_batch,label_batch])
    plt.imshow(batch_images[0])

I've attached a link to my Google Drive where I've stored my data and code:

https://drive.google.com/open?id=0B-hAFmA-zmGdTndyaHJzWEdQaFE

It contains three files.

  • model.ipynb - it's the main file which has CNN and session,
  • preprocess.ipynb - it's the code I used to process my data and
  • data.pickle - I've already processed and stored my data in this file so you don't have to run preprocess.ipynb.
halfer
  • 19,824
  • 17
  • 99
  • 186
  • Problems that are illustrated off-site are not on-topic here. Can you show the problem in the question itself? – halfer Jul 20 '17 at 19:10
  • I'm not able to properly format huge blocks of my code and StackOverflow isn't accepting it.What should I do? – Karthik Arcot Jul 21 '17 at 11:02
  • Ive added my tensorboard graph which is produced in the first iteration if its of any help – Karthik Arcot Jul 21 '17 at 11:07
  • What do you mean by "StackOverflow isn't accepting it"? If the block of code is too large then yes, you need to cut it down to a smaller example. – halfer Jul 21 '17 at 11:33
  • hey, @halfer I narrowed down the problem to my input pipeline, coz I ran it separately and it was showing the same problem-it just gets stuck and stays like that. – Karthik Arcot Jul 21 '17 at 17:39
  • It works now, I figured it out, if anyone has a similar problem, just know that if ur using train.batch with 'enqueue_many=False', the tensor list [image, label] has to be a dequeue operation from another queue and ul have to run queue-runners and add coordinators in ur session. – Karthik Arcot Jul 23 '17 at 10:39

0 Answers0