vidaug
vidaug copied to clipboard
Is it for one video (sequence of images) or a batch of videos?
Thank you for providing your code. While checking the example code
for batch_idx in range(1000):
# 'video' should be either a list of images from type of numpy array or PIL images
video = load_batch(batch_idx)
video_aug = seq(video)
train_on_video(video)
the loop is running on batch_idx (i suppose batch of videos) but in comment it says video is list of images. Can I give a batch of videos or I will have to give single video at a time?
I am using vidaug with batches in TF2 like this, I hope it helps:
from vidaug import augmentors as va
# Image augmentation module
def get_augmenter(batch):
aug_array = np.zeros_like(batch)
sometimes = lambda aug: va.Sometimes(0.5, aug)
seq = va.OneOf([
sometimes(va.VerticalFlip()),
sometimes(va.RandomRotate(degrees=5)),
sometimes(va.Downsample()),
sometimes(va.Upsample()),
sometimes(va.RandomShear(x=0.2, y=0.2))
])
for i, vid in enumerate(batch):
aug_vid = seq(vid.numpy())
aug_array[i] = aug_vid
aug_array = tf.convert_to_tensor(aug_array)
return aug_array