DALI
DALI copied to clipboard
can not find a op or function like width_shift_range in tf.ImageDataGenerator
datagen_vgg = ImageDataGenerator( // this is tensorflow code rotation_range=0, horizontal_flip=True, width_shift_range=0.1, height_shift_range=0.1, #zoom_range=0.3 )
i can find function like rotation_range ,horizontal_flip when i use import nvidia.dali.fn but i can not find a function to instead replace width_shift_range and height_shift_range
Hi @zcuuu,
If I understand correctly how these parameters work, you can achieve that with DALI using slice operator, setting out_of_bounds_policy='pad', and using random values to feed rel_start while keeping the shape unchanged.
Something like this should work:
images = fn.slice(images, out_of_bounds_policy='pad',
rel_shape=(1,1),
rel_start=fn.random.uniform(shape=(2,), dtype=types.FLOAT, range=(-1,1)))