hajbabaeim
hajbabaeim

Reputation: 156

How to feed multiple inputs through feed_dict in 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?

Upvotes: 7

Views: 5203

Answers (2)

Vijay Mariappan
Vijay Mariappan

Reputation: 17201

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)

Upvotes: 5

nttstar
nttstar

Reputation: 341

You should split/slice your images inside computation graph and use a single input instead.

Upvotes: -2

Related Questions