November 2017
Intermediate to advanced
304 pages
6h 58m
English
TensorFlow allows us to create a reliable input pipeline for quick and easy training. In this section, we will implement tf.TextLineReader to read the train and test text files. We will use tf.train.batch to read and preprocess images in parallel.
First, we need to create a new Python file named datasets.py in the project directory and add the following code:
import tensorflow as tf import os def load_files(filenames): filename_queue = tf.train.string_input_producer(filenames) line_reader = tf.TextLineReader() key, line = line_reader.read(filename_queue) label, image_path = tf.decode_csv(records=line, record_defaults=[tf.constant([], dtype=tf.int32), tf.constant([], dtype=tf.string)], field_delim=' ...
Read now
Unlock full access