Computer Vision News - September 2016

18 Computer Vision News Tool The code for executing this Queue reader graph is as follows: Note that we omitted the cv2.imread and the feed_dict={my_img: raw_image_data} as now the files will be read by the queue. Update parameters Last but not least, we will demonstrate how the parameter can be updated. For example, setting different values of theta for each image by raising it by pi/1800 at each iteration. Here is the code for doing that: Tool It starts the QueueRunners by calling tf.train.start_queue_runners(sess=sess). This call is functional, it creates the threads for enqueueing data to the queue, which will later be processed by the operations defined by the TensorFlow graph. 1. with tf.Session() as sess: 2. sess.run(init_op) 3. 4. coord = tf.train.Coordinator() 5. threads = tf.train.start_queue_runners(coord=coord) 6. for i in range(4): # length of your filename list 7. lines = sess.run(X2)[0] The updated graph with the Queue reader looks now as follows: 1. with tf.Session() as sess: 2. sess.run(init_op) 3. 4. coord = tf.train.Coordinator() 5. threads = tf.train.start_queue_runners(coord=coord) 6. for i in range(4): # length of your filename list 7. assign_op = _theta.assign_add (np.pi / 1800) 8. lines = sess.run([assign_op, X2])[0] The only update we have to make is in lines 7-8, where we add pi/1800 at each iteration using the _theta.assign_add function; and we add this operation into the run() session.

RkJQdWJsaXNoZXIy NTc3NzU=