Computer Vision News - September 2016

We first have to define two variables using the tf.Variable() function (lines 1-2). Then, we can define them as parameters being sent to the function (line 4). Note that each variable has an initial value which can later be changed. The updated graph now looks as follows: (3) Queue reader Obviously, we didn’t write all this code for analyzing a single image and most probably you have many files which you need to examine, analyze and evaluate. The process of reading many data files and feeding them into the module can be quite tedious. Luckily, TensorFlow comes with several functionalities for easing this process. One of them is the queue reader. Queue reader parallelizes the reading process by performing it on a different thread from the one executing the rest of the code. Here is the code defining the Queue reader for reading a list of .png images: In the code above, we start by defining a queue initialized with a list of filenames (four in this example). Those names are fed into our model string_input_producer (line 1). Next, the wholeFileReader (line 3) tells TensorFlow to read a complete file at a time. Then the reader.read (line 4) extracts and reads those files from the queue. Lastly, the files are decoded by their type - png (line 5), so that you can have a decoder per file type (nice and modular, isn’t it?). Computer Vision News Tool 17 Tool “ Nice and modular ” You can see the ‘rho’ and the ‘theta’ parameters now being part of the TensorFlow graph and fed into the Hough function. Parameters, of course, are meant to be changeable; later we will see how to do it. 1. filename_queue = tf.train.string_input_producer(['im1.png','im2.png','im3.png','im4.png'],name="FileNames") # list of files to read 2. with tf.name_scope("RederType"): 3. reader = tf.WholeFileReader(name="red") 4. key, value = reader.read(filename_queue, name="Reader") 5. my_img = tf.image.decode_png(value, name="pngDec") # use png decoder

RkJQdWJsaXNoZXIy NTc3NzU=