More specifically,
1) Only `decode_bmp` or `decode_image` ops should be able to decode BMP data.
2) `decode_and_crop_jpeg` should only work on JPEG data.
Note: By the API, `decode_jpeg`, `decode_png` and `decode_gif` can decode any of JPEG, PNG and GIF formats.
PiperOrigin-RevId: 337546579
Change-Id: I2a9cd3271c26fc8d4099c86bfb0f84f87bdcdf87
This fix tries to address the issue raised in 42129 where segmentation fault
happened in tf.image.crop_and_resize when boxes is inf or nan.
This fix adds the check to make sure boxes is not inf or nan (isfinite)
This fix fixes 42129.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
tf.image.stateless_random_brightness
tf.image.stateless_random_contrast
tf.image.stateless_random_hue
tf.image.stateless_random_saturation
tf.image.stateless_random_jpeg_quality
These functions are deterministic unlike the existing `tf.image.random*` functions, which reuse same kernel if called with the same arguments and keep internal counter. The new functions, given the same seed, guarantee the same results independent of how many times the they are called, and independent of global seed settings.
Added tests for the new stateless functions.
PiperOrigin-RevId: 324015264
Change-Id: I4bc1464d3551aeddc8046776b6edc6d50b87d0b1
This PR tries to address the issue raised in 28256 where
tf.image.decode_png process palette-based png image
incorrectly.
The issue was an redundant call png_set_rgb_to_gray in
tensorflow/core/lib/png/png_io.cc. This PR fixes the issue.
This PR fixes 28256.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
- Registers existing Decode* ops to DecodeImageV2Op kernel.
- Removes `decode_bmp_op.cc` as a newer version of its implementation exists in `decode_image_op.cc`. Removes all references to the deleted file.
PiperOrigin-RevId: 318397665
Change-Id: I30daaa535e8f99655e836d635f627cbac3086694
This PR tries to address the issue raised in 40580 where an error
was thrown out when tf.image.flip_left_right process a tensor of unknown
rank.
The reason was that tf.image.flip_left_right assumes rank == 3 in case
of unknown rank.
This PR adjust to use array_ops.rank(image) to obtain the true rank
when unknown rank is present.
This PR fixes 40580.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
- Creates new op kernel (`DecodeImageV2Op`) that can decode all four image formats (jpg, png, gif, bmp). `DecodeImage` is the op name. `DecodeBmpOp` is moved into `DecodeImageV2Op`. (Now we have `gen_image_ops.decode_image` as opposed to previous `decode_image` which was a pure python implementation.)
- Updates GIF decoder to take in `expand_animation` flag for decoding just one frame.
- Removes data parsing and format checking logic from python layer entirely.
- Updates magic bytes for detecting image formats.
- Replicates portions of `convert_image_dtype` functionality in kernel (for optionally converting uint8/uint16 -> float32).
PiperOrigin-RevId: 317891936
Change-Id: I84f18e053f6dad845d9f2a61e1119f4de131c85d
Properly deal with boxes that are suppressed by score_threshold when canonicalizing coordinates.
Also suppress boxes whose score equals to the score_threshold to be compatible with previous implementation's behavior.
Computing `num_boxes_after_padding // tile_size` is moved outside of loop condition to make it easier for Grappler's constant folding optimization.
Output is always padded to max_output_size even when the input size (number of boxes) is less than max_output_size.
Properly handle inputs with dynamic shapes.
Due to issues with TFLite conversion, we set a forward compatibility window of 3 weeks. Until 2020/4/20, calling non_max_suppression_padded defaults to the old implementation.
PiperOrigin-RevId: 303791501
Change-Id: I7307634bf493e0fb971b50e71548fd97e27e2073