-
Notifications
You must be signed in to change notification settings - Fork 617
Closed
Labels
Description
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): Ubuntu 18.04
- TensorFlow installed from (source or binary): Binary
- TensorFlow version (use command below): tf-nightly-gpu-2.0-preview
- TensorFlow Addons installed from (source, PyPi): source
- TensorFlow Addons version: 0.3.0a
- Python version and type (eg. Anaconda Python, Stock Python as in Mac, or homebrew installed Python etc): Anaconda Python Linux
- Bazel version (if compiling from source): 0.25.2
- GCC/Compiler version (if compiling from source): not sure
- Is GPU used? (yes/no): yes
- GPU model (if used): Nvidia Titan X (Pascal)
Describe the bug
I'm trying to use tfa.image.rotate with tf.data for training time data augmentations, but it is crashing my kernel when used.
Describe the expected behavior
rotate the tensor image
Code to reproduce the issue
from random import randint
import matplotlib.pyplot as plt
def preprocess_image(image):
# decode PNG
image = tf.image.decode_image(image, channels=3)
# data augmentation
# rotate random
angle = random.randint(-1,1)
image = tfa.image.rotate(image,angle) #,interpolation='BILINEAR')
# resize
image = tf.image.resize(image, [224, 224])
# normalize = convert to [-1:1]
offset = 127.5
image = (image-offset)/offset
return image
def load_and_preprocess_image(path):
image = tf.io.read_file(path)
return preprocess_image(image)
# load image and return a transformed and normalized image
img_tensor = load_and_preprocess_image(all_image_paths[1])
plt.imshow(img_tensor)
Other info / logs
The kernel doesn't log any errors, just crashes. If I remove the tf.image.resize from the code, it works fine. Also, the source code says to use scalar angles (I wasn't sure if these are radian or degrees). Is there any documentations on how to use the tfa.image functions?