这是indexloc提供的服务,不要输入任何密码
Skip to content

tf.image.resize/resize_with_crop_or_pad/pad_to_bounding_box/extract_glimpse crash(abort) #46890

@DNXie

Description

@DNXie

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below):2.1.0
  • Python version:3.7.6
  • Bazel version (if compiling from source):N/A
  • GCC/Compiler version (if compiling from source):N/A
  • CUDA/cuDNN version:N/A
  • GPU model and memory:N/A

Describe the current behavior
The following APIs crash(abortion) when the given size is large

  • tf.image.resiz
  • tf.image.resize_with_crop_or_pad
  • tf.image.pad_to_bounding_box
  • tf.image.extract_glimpse
  • tf.keras.backend.resize_images

Describe the expected behavior
expect exception messages if the input is not expected instead of crash

Standalone code to reproduce the issue

tf.image.resize

import tensorflow as tf
import numpy as np
tf.image.resize(images=np.ones((5,5,5)), size=[2065374891,1145309325])

Output:

2021-02-03 17:41:13.484992: F tensorflow/core/framework/tensor_shape.cc:353] Check failed: 0 <= new_num_elements (0 vs. -6619278462293758741)
Aborted (core dumped)

tf.image.resize_with_crop_or_pad

import tensorflow as tf
import numpy as np
tf.image.resize_with_crop_or_pad(image=np.ones((1,1,1)), target_height=5191549470, target_width=5191549470)

Output:

2021-02-03 17:42:15.468265: F tensorflow/core/framework/tensor_shape.cc:353] Check failed: 0 <= new_num_elements (0 vs. -1)
Aborted (core dumped)

tf.image.pad_to_bounding_box

import tensorflow as tf
import numpy as np
tf.image.pad_to_bounding_box(image=np.ones((1,1,1)), target_height=5191549470, target_width=5191549470, offset_height=1, offset_width=1)

Output

2021-02-03 17:42:52.556583: F tensorflow/core/framework/tensor_shape.cc:353] Check failed: 0 <= new_num_elements (0 vs. -1)
Aborted (core dumped)

tf.image.extract_glimpse

import tensorflow as tf
import numpy as np
tf.image.extract_glimpse(input=np.ones((5,5,5,5)), size=[1574700351, 451745106], offsets=np.ones((5,2)))

Output:

2021-02-03 17:43:30.140277: F tensorflow/core/framework/tensor_shape.cc:338] Check failed: 0 <= n (0 vs. -662664649191246466)
Aborted (core dumped)

tf.keras.backend.resize_image

import tensorflow as tf
import numpy as np
tf.keras.backend.resize_images(x=np.ones((1,5,3,15)), height_factor=5628955348197345288, width_factor=5628955348197345288, data_format='channels_last')

Output:

2021-02-03 17:54:01.192819: F tensorflow/core/framework/tensor_shape.cc:353] Check failed: 0 <= new_num_elements (0 vs. -5948468124908472256)
Aborted (core dumped)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions