Closed amitani closed 3 years ago
Enable half_pixel_centers=True for resizing after GradCAM to avoid shift by a half pixel.
It will make the behavior compatible to tf.image.resize in tf2. See https://github.com/tensorflow/tensorflow/blob/v2.4.1/tensorflow/python/ops/image_ops_impl.py#L1623
Alternatively, this is equivalent to changing tf.image.resize_bilinear to tf.compat.v2.image.resize, or to tf.image.resize and change tf import to v2.
Note that only changing this to tf.image.resize won't solve the bug, because in tf1, it doesn't enable half_pixel_centers. https://github.com/tensorflow/tensorflow/blob/v2.4.1/tensorflow/python/ops/image_ops_impl.py#L1447
Closed since we are now using skimage.transform.resize.
Enable half_pixel_centers=True for resizing after GradCAM to avoid shift by a half pixel.
It will make the behavior compatible to tf.image.resize in tf2. See https://github.com/tensorflow/tensorflow/blob/v2.4.1/tensorflow/python/ops/image_ops_impl.py#L1623
Alternatively, this is equivalent to changing tf.image.resize_bilinear to tf.compat.v2.image.resize, or to tf.image.resize and change tf import to v2.
Note that only changing this to tf.image.resize won't solve the bug, because in tf1, it doesn't enable half_pixel_centers. https://github.com/tensorflow/tensorflow/blob/v2.4.1/tensorflow/python/ops/image_ops_impl.py#L1447