diff options
author | Dandelion Man? <dandelion@google.com> | 2017-12-15 17:12:41 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-12-15 17:16:29 -0800 |
commit | d55f532867a3670d66460c5ee3b774519542adc1 (patch) | |
tree | 7de4d85bcd61e93401459276b4d371ab0be23c1f /tensorflow/docs_src/api_guides | |
parent | 32d5048ae96116202f2aa0fa739ef37514ee8a54 (diff) |
Merge changes from github.
PiperOrigin-RevId: 179258973
Diffstat (limited to 'tensorflow/docs_src/api_guides')
-rw-r--r-- | tensorflow/docs_src/api_guides/python/image.md | 1 | ||||
-rw-r--r-- | tensorflow/docs_src/api_guides/python/reading_data.md | 27 |
2 files changed, 20 insertions, 8 deletions
diff --git a/tensorflow/docs_src/api_guides/python/image.md b/tensorflow/docs_src/api_guides/python/image.md index a2c8c3c3c9..051e4547ee 100644 --- a/tensorflow/docs_src/api_guides/python/image.md +++ b/tensorflow/docs_src/api_guides/python/image.md @@ -19,6 +19,7 @@ Note: The PNG encode and decode Ops support RGBA, but the conversions Ops presently only support RGB, HSV, and GrayScale. Presently, the alpha channel has to be stripped from the image and re-attached using slicing ops. +* @{tf.image.decode_bmp} * @{tf.image.decode_gif} * @{tf.image.decode_jpeg} * @{tf.image.encode_jpeg} diff --git a/tensorflow/docs_src/api_guides/python/reading_data.md b/tensorflow/docs_src/api_guides/python/reading_data.md index 4594887349..f316cce953 100644 --- a/tensorflow/docs_src/api_guides/python/reading_data.md +++ b/tensorflow/docs_src/api_guides/python/reading_data.md @@ -175,14 +175,25 @@ For example, [`tensorflow/examples/how_tos/reading_data/convert_to_records.py`](https://www.tensorflow.org/code/tensorflow/examples/how_tos/reading_data/convert_to_records.py) converts MNIST data to this format. -To read a file of TFRecords, use -@{tf.TFRecordReader} with -the @{tf.parse_single_example} -decoder. The `parse_single_example` op decodes the example protocol buffers into -tensors. An MNIST example using the data produced by `convert_to_records` can be -found in -[`tensorflow/examples/how_tos/reading_data/fully_connected_reader.py`](https://www.tensorflow.org/code/tensorflow/examples/how_tos/reading_data/fully_connected_reader.py), -which you can compare with the `fully_connected_feed` version. +The recommended way to read a TFRecord file is with a @{tf.data.TFRecordDataset}, [as in this example](https://www.tensorflow.org/code/tensorflow/examples/how_tos/reading_data/fully_connected_reader.py): + +``` python + dataset = tf.data.TFRecordDataset(filename) + dataset = dataset.repeat(num_epochs) + + # map takes a python function and applies it to every sample + dataset = dataset.map(decode) +``` + +To acomplish the same task with a queue based input pipeline requires the following code +(using the same `decode` function from the above example): + +``` python + filename_queue = tf.train.string_input_producer([filename], num_epochs=num_epochs) + reader = tf.TFRecordReader() + _, serialized_example = reader.read(filename_queue) + image,label = decode(serialized_example) +``` ### Preprocessing |