Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to feed multiple inputs through feed_dict in tensorflow

Tags:

tensorflow

I have a network consist of multiple sub-network (multiple convolution net and at last one fully connected + soft max layer). Every ConvNet feed with specific region and size of images. so, to feed my network I write image place holder for every convnet input and one label place holder to feed label of all images in one batch (all of the input images in all convnet inputs have the same labels). Unfortunately I don't have any idea for feed_dict part. for example this code is for only one convnet training:

    images_r, labels_r = sess.run([images, labels])
    train_feed = {images_placeholder: images_r,
              labels_placeholder: labels_r}
    _, loss_value = sess.run([train_op, loss_func], feed_dict=train_feed)

How can I extend above code for feed all conv nets?

like image 879
mhajbabaei Avatar asked Jul 04 '17 07:07

mhajbabaei


1 Answers

So for each of the conv networks, if the placeholders for inputs are: conv_1_input, conv_2_input.... conv_N_input, then you pass the list in the feed_dict like this:

train_feed = {`conv_1_input`: image_1, `conv_2_input`: image_2,.. `conv_N_input`: image_N,
          labels_placeholder: labels_r}
_, loss_value = sess.run([train_op, loss_func], feed_dict=train_feed)
like image 78
vijay m Avatar answered Nov 15 '22 09:11

vijay m