Merge pull request #37558 from Angus-Luo:master

PiperOrigin-RevId: 301172077
Change-Id: Id2a2d3dd49f198fb463eef7838d38d62c49adb6b
This commit is contained in:
TensorFlower Gardener 2020-03-16 09:33:07 -07:00
commit f46ac90866
7 changed files with 11 additions and 13 deletions

View File

@ -21,6 +21,6 @@ uncompressed by running:
convert $src.gif -coalesce $dst.gif
This op also supports decoding JPEGs and PNGs, though it is cleaner to use
`tf.image.decode_image`.
`tf.io.decode_image`.
END
}

View File

@ -75,6 +75,6 @@ downscaling the image later.
This op also supports decoding PNGs and non-animated GIFs since the interface is
the same, though it is cleaner to use `tf.image.decode_image`.
the same, though it is cleaner to use `tf.io.decode_image`.
END
}

View File

@ -34,6 +34,6 @@ If needed, the PNG-encoded image is transformed to match the requested number
of color channels.
This op also supports decoding JPEGs and non-animated GIFs since the interface
is the same, though it is cleaner to use `tf.image.decode_image`.
is the same, though it is cleaner to use `tf.io.decode_image`.
END
}

View File

@ -317,8 +317,8 @@ class DecodeImageOp : public OpKernel {
} else {
status = errors::InvalidArgument(
"Got ", num_frames, " frames, but animated gifs ",
"can only be decoded by tf.image.decode_gif or ",
"tf.image.decode_image");
"can only be decoded by tf.io.decode_gif or ",
"tf.io.decode_image");
}
if (!status.ok()) {
VLOG(1) << status;

View File

@ -44,15 +44,13 @@ def read_tensor_from_image_file(file_name,
output_name = "normalized"
file_reader = tf.read_file(file_name, input_name)
if file_name.endswith(".png"):
image_reader = tf.image.decode_png(
file_reader, channels=3, name="png_reader")
image_reader = tf.io.decode_png(file_reader, channels=3, name="png_reader")
elif file_name.endswith(".gif"):
image_reader = tf.squeeze(
tf.image.decode_gif(file_reader, name="gif_reader"))
image_reader = tf.squeeze(tf.io.decode_gif(file_reader, name="gif_reader"))
elif file_name.endswith(".bmp"):
image_reader = tf.image.decode_bmp(file_reader, name="bmp_reader")
image_reader = tf.io.decode_bmp(file_reader, name="bmp_reader")
else:
image_reader = tf.image.decode_jpeg(
image_reader = tf.io.decode_jpeg(
file_reader, channels=3, name="jpeg_reader")
float_caster = tf.cast(image_reader, tf.float32)
dims_expander = tf.expand_dims(float_caster, 0)

View File

@ -250,7 +250,7 @@
"# Function to load an image from a file, and add a batch dimension.\n",
"def load_img(path_to_img):\n",
" img = tf.io.read_file(path_to_img)\n",
" img = tf.image.decode_image(img, channels=3)\n",
" img = tf.io.decode_image(img, channels=3)\n",
" img = tf.image.convert_image_dtype(img, tf.float32)\n",
" img = img[tf.newaxis, :]\n",
"\n",

View File

@ -605,7 +605,7 @@ class Tensor(_TensorLike):
```python
_, image_data = tf.compat.v1.TFRecordReader(...).read(...)
image = tf.image.decode_png(image_data, channels=3)
image = tf.io.decode_png(image_data, channels=3)
# The height and width dimensions of `image` are data dependent, and
# cannot be computed without executing the op.