0

I have 3500 image in my system. I want to attach label each image to make learn So I made answer list

local_name = {'grassland': '[1,0,0,0,0,0,0]', 'canyon':'[0,1,0,0,0,0,0]', 'forest':'[0,0,1,0,0,0,0]',
'king\'s load':'[0,0,0,1,0,0,0]', 'lake':'[0,0,0,0,1,0,0]', 'desert':'[0,0,0,0,0,1,0]', 'ruin':'[0,0,0,0,0,0,1]'}
answer = []

def make_answer():
    for i in range (0, 3500):
        if i<500 :
            answer.append(local_name['grassland'])
        elif i<1000 :
            answer.append(local_name['canyon'])
        elif i<1500 :
            answer.append(local_name['forest'])
        elif i<2000 :
            answer.append(local_name['king\'s load'])
        elif i<2500 :
            answer.append(local_name['lake'])
        elif i<3000 :
            answer.append(local_name['desert'])
        elif i<3500 :
            answer.append(local_name['ruin'])
        else :
            print("not exist")

and I put into queue

def input_pipeline(batch_size,train_logical = True):
    images = ['img/background/back_{}.png'.format(i) for i in range(0,3500)]
    image_queue = tf.train.string_input_producer([images,answer],shuffle=False) #error point
    image,label = read_image_files(image_queue) 

    min_after_dequeue = 5000
    capacity = min_after_dequeue + 3*batch_size
    example_batch, label_batch = tf.train.shuffle_batch([image,label],batch_size=batch_size,capacity=capacity,min_after_dequeue=min_after_dequeue)
    print(example_batch.shape,label_batch.shape)
    return (example_batch, label_batch)

ValueError: Shapes (3500,) and () are not compatible

size of answer, images are both 3500 How can I solve it?

HJRaBob
  • 3
  • 1
  • did you check if the `answer` you stuff into `tf.traom.ecetera` contains anything? did you call `make_answer()`? did you check it modifies your "global" `answer` as youthink it does? [How to debug small programs (#1)](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/) – Patrick Artner May 16 '18 at 14:21
  • Thanks for good link. I called `answer`, and checked `answer` was changed. But I don't know `tf.traom.ecetera` I can't find any information about that. – HJRaBob May 17 '18 at 04:21
  • https://www.tensorflow.org/api_docs/python/tf/train/string_input_producer takes no labeled string, it takes a 1-dim string list. Go to the dupe I looked up for you, it should about do what you wanted to. - I found it by inputting `tf.train.string_input_producer` and `label` into almighty google. – Patrick Artner May 17 '18 at 05:28
  • thanks X) I know what was problem – HJRaBob May 17 '18 at 07:13

0 Answers0