title: Tensorflow input pipeline with queues workflow - feeding data
body: <p>I am using the Tensorflow input pipeline via queues.</p>
  
  <p>Therefore, I do:</p>
  
  <pre><code>images, volumes = utils.inputs(FLAGS.train_file_path, FLAGS.batch_size, FLAGS.num_epochs)
  v_images, v_volumes = utils.inputs(FLAGS.val_file_path, FLAGS.batch_size)
  </code></pre>
  
  <p>To read the data.</p>
  
  <pre><code>init = tf.group(tf.global_variables_initializer(), tf.local_variables_initializer())
  
  
  with tf.Session() as sess:
  
      # Start input enqueue threads.
      coord = tf.train.Coordinator()
      threads = tf.train.start_queue_runners(sess=sess, coord=coord)
      try:
  
          step = 0
          while not coord.should_stop():
              _, train_loss = sess.run([train_optimizer, loss])
  
              if step % FLAGS.val_interval == 0:
                  for val_step in range(0, FLAGS.val_iter):
                          val_loss = sess.run(v_loss)
  </code></pre>
  
  <p>How can I make sure that I use the <code>images, volumes</code> and volumes for the training and the <code>v_images, v_volumes</code> for validation?</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>logits = utils.inference(images, FLAGS.stacks, True)
  v_logits = utils.inference(v_images, FLAGS.stacks, False)
  
  loss = utils.get_loss(logits, volumes, FLAGS.stacks, 'train')
  v_loss = utils.get_loss(v_logits, v_volumes, FLAGS.stacks, 'val')
  </code></pre>
  
  <p><strong>EDIT 2</strong></p>
  
  <pre><code>summary_train_op = tf.summary.merge_all('train')
  summary_val_op = tf.summary.merge_all('val')
  
  with tf.Session() as sess:
  
      summary_writer = tf.summary.FileWriter(FLAGS.train_dir + FLAGS.run, sess.graph)
      summary_writer_val = tf.summary.FileWriter(FLAGS.train_dir + FLAGS.run + FLAGS.run_val)
  </code></pre>