Hi there! As you may know we have been working on video recognition algorithms a bit since the Spring. One of the more challenging aspects in video recognition is getting enough data to train a model. One of the ways we can increase the power of our training data is through data augmentation. In this post I will show how I have been doing data augmentation using the ‘vidaug’ library in Python.
The data
For illustration purposes, let us assume a training dataset ‘train_ds’ with videos of me waving my hand. First let us check out the content and format of the dataset by defining a function ‘to_gif’ that animates the frames of a video in train_ds:
Note that I am usually less square-shaped: This video was taken using a phone camera with a 4:3 aspect ratio, which gets distorted when reshaped into a square format!
The vidaug library has 18 different augmentation types, including random cropping, rotation, vertical and horizontal flips and a variety of image distortions. For this example we are going to concatenate 5 different augmentation types, each applied with a probability of 0.5.
sometimes = lambda aug: va.Sometimes(0.5, aug) # Used to apply each augmentor with 50% probability
Et voilá, out come a bunch of augmented Pablos for you!
You can of course play with parameters for more extreme augmentations. For example, with a rotation of 90 degrees ‘va.RandomRotate(degrees=10)’ you can get Pablos in all orientations:
OK that’s enough Pablos for today, hope you found that useful!
About Rosan International
ROSAN is a technology company specialized in the development of Data Science and Artificial Intelligence solutions with the aim of solving the most challenging global projects. Contact us to discover how we can help you gain valuable insights from your data and optimize your processes.
I was recently asked by some colleagues to demonstrate the usefulness of Multilevel Regression and Post-stratification (MRP) for small area... read more
What is Thematic Analysis?
Thematic analysis (TA) is a qualitative research method used to systematically identify, analyze, and interpret patterns or... read more
By Rosan International | Monday, September 15, 2023 | Reproducibility
The Challenge of Reproducibility
OK, stop me if you think you’ve heard... read more