One of the techniques that have accelerated machine learning on insufficient real-world datasets is data augmentation.

Data augmentation is the art of creating artificial data.

For example, you can take an image, flip it, change color, and now you have a new image. Image
Yes, data augmentation is the art of creating artificial data to expand a given small dataset.

It has shown that it works so well(most of the time), and it remarkably handles overfitting.
Nearly most types of data can be augmented, but I have noticed that it works well in unstructured data(images, video, sound).

So, this thread will focus more on images, sounds, and videos.

For more about structured vs unstructured data 👇

But why do we have to augment data?

Let's say that you want to build an image classifier (say for a rare real-world use case) and with a lot of effort, you can only get 50 images.
Doubling the efforts, you can get 20 images more. You would likely want to find scalable ways of boosting your dataset.

Thanks to advances in ML techniques, this is not impossible.
Images are probably the most data that augmenting will always work so well.

Here are various ways to augment images:

◆Flipping images horizontally/vertically or both
◆Rotating the images to a given degree
More image augmentation options:

◆Changing the color and contrast
◆Zooming the image in/out
◆Adding noises
◆And more (this is an art)

The below image summarizes image augmentation well. Image
Like any other technique, data augmentation is not always a solution to everything.

It will improve the results when it is applied in regard to the error analysis.
Here is an example of what I mean...

Say you have 500 images of cats and 900 images of dogs. Augmenting cats and dogs evenly will not improve the results.

You would want to create more images of cats than dogs.
One more thing about images augmentation:

The augmented images have to be realistic.

You can virtually generate many image scenarios but if those scenarios are not realistic,

It will hurt the model.
Sounds and videos can be augmented too.

Sound can be augmented by adding noise, slowing/speeding the sound, shifting the time, narrowing or widening the sound. Image
Videos can be augmented as sound.

You can slow or speed them, shift the time, split the video, and apply some custom transformations to individual clips.

For example, some clips can have a reduced brightness, different color, etc.
Data augmentation is the art that can not only be applied to a small dataset but even to a big dataset.

This is because it introduces some diversity in training samples and this is a good thing.
About data augmentation tooling,

◆ For TensorFlow guys, there are ImageDataGenerator which is so simple to use, and (experimental) augmentation layers.

keras.io/api/layers/pre…

◆ And for Pytorch users (and beyond), there is *Ugly.

github.com/facebookresear…
This is the end of the thread that was about the art of data augmentation.

To summarize,

Data augmentation can be used to expand training samples and preventing overfitting as a result.

Nearly most data can be augmented.
◆Images: Flipping, changing color & contrast, adding noise, and zooming in/out.

◆Videos: Adding noise, slowing/speeding, shifting time, and applying custom changes to individual clips.

◆Sounds: Adding noise, narrowing/widening voice, shifting time, speeding/slowing sound
For more about this art, beyond the thread, here is a full article:

jeande.medium.com/a-handy-notes-…
Thank you for reading.

I am regularly writing about machine learning ideas and best practices. I challenge myself to create actionable content, and my goal is to create more.

You can support me by following @Jeande_d,

Leaving a ♡,

Or sharing the post with your friends.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Jean de Nyandwi

Jean de Nyandwi Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Jeande_d

5 Aug
For many problems, a batch size of 32 works so well.

A batch size mostly affects training time. The larger the batch size, the faster the training.

The smaller, the slower training.
The only issue with the large batch size is that it requires many steps per epoch to reach optimal performance.

And you need to have a large dataset in order to have enough steps per epoch.

With that said, 32 is a good default value to try at first.
Here are 2 great papers that you can use to learn more:

Practical Recommendations for Gradient-Based Training of Deep Architectures: arxiv.org/pdf/1206.5533.…
Read 4 tweets
3 Aug
Choosing the right machine learning algorithm for the problem can be hard.

This thread is about 3 questions that can help in the model selection process.

A thread🧵👇
1. Will the predictions have to be fully explainable?

Most models are not explainable. If you're looking for explainability, neural nets may not help. Models like decision trees can.

More interesting facts about decision trees beyond explainability👇

2. How big is the dataset?

For big datasets, neural nets and other complex models like ensemble methods can be a good choice.
Read 7 tweets
23 Jul
One of the neural network's architectures that have outpaced traditional algorithms for image recognition is Convolutional Neural Networks(CNN), a.k.a ConvNets.

Inspired by brain's visual cortex, CNN has become a decent plugin for many computer vision tasks.

More about CNN 👇
CNN is made of 3 main blocks which are:

◆Convolutional layer(s)
◆Pooling layer(s)
◆Fully connected layer(s)

Let's talk about each block.
1. Convolutional layers

The convolution layers are the backbone of the whole CNN. They are used to extract the features in the images using filters.
Read 23 tweets
21 Jul
In any typical application powered by machine learning,

whether that is a text classifier running in a web browser, or

a face detector running in a mobile phone, its machine learning code(or model) will be or close to 5% of the whole app.

Other 95%...👇 Image
Other 95% includes data, analysis, and software-related things.

A machine learning model being only 5% of the whole application often implies that we should be doing something else beyond tuning models.
Such as:

◆ Building irreproducible data preparation pipelines.
◆ Evaluating properly.
Read 4 tweets
19 Jul
PCA is an unsupervised learning algorithm that is used to reduce the dimension of large datasets.

For such reason, it's commonly known as a dimensional reduction algorithm.

PCA is one of these useful things that is not talked about. But there is a reason 👇
The PCA's ability to reduce the dimension of the dataset motivates other use cases.

Below are some:

◆ To visualize high dimensional datasets, particularly because visualizing such datasets is impractical.
◆ To select the most useful features while getting rid of useless information/redundant features.

But not always, sometimes useful information will be lost too especially if the original data was already good and didn't contain noises.
Read 26 tweets
23 May
Machine Learning has transformed many industries, from banking, healthcare, production, streaming, to autonomous vehicles.

Here are examples of how that is happening👇
🔸A bank or any credit card provider can detect fraud in real-time. Banks can also predict if a given customer requesting a loan will pay it back or not based on their financial history.

2/
🔸A Medical Analyst can diagnose a disease in a handful of minutes, or predict the likelihood or course of diseases or survival rate(Prognosis).
🔸An engineer in a given industry can detect failure or defect on the equipment

3/
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(