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.
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.
Gestionar el consentimiento de las cookies
Para ofrecer las mejores experiencias, utilizamos tecnologías como las cookies para almacenar y/o acceder a la información del dispositivo. El consentimiento de estas tecnologías nos permitirá procesar datos como el comportamiento de navegación o las identificaciones únicas en este sitio. No consentir o retirar el consentimiento, puede afectar negativamente a ciertas características y funciones.
Funcional
Always active
El almacenamiento o acceso técnico es estrictamente necesario para el propósito legítimo de permitir el uso de un servicio específico explícitamente solicitado por el abonado o usuario, o con el único propósito de llevar a cabo la transmisión de una comunicación a través de una red de comunicaciones electrónicas.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Estadísticas
El almacenamiento o acceso técnico que es utilizado exclusivamente con fines estadísticos.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
El almacenamiento o acceso técnico es necesario para crear perfiles de usuario para enviar publicidad, o para rastrear al usuario en una web o en varias web con fines de marketing similares.