Now, let's take a look at a very important regularization technique, and that's called data augmentation.
So let's take a look at this.
So the documentation, as I said, is one of the most effective ways of reducing overfitting in a convolutional
neural network or in any general neural network or machine learning algorithm.
It solves a problem here.
It solves a problem of not having enough data or not having enough variation in your dataset.
And I'll explain to you how it does that and naturally imitate assets.
I'll explain why let themselves naturally to applying data augmentation techniques.
And that's because what is data augmentation?
Imagine we have an image like this that's being fed into a neural network.
However, this is an image and as you know, from open TV or even from Photoshop, Instagram filters
all of those things.
You can apply a lot of different variations to one particular image in the play of basically an infinite
amount of variations.
You can get all of these things here you can.
This is called flip up.
This one is just a bit blurry.
This one is zoomed in a bit, as you can see.
There are many, many, many image augmentations or data augmentations.
You can apply.
So what does this do?
Well, what it does is it effectively makes the neural net to accomplish a neural net see a much wider
variety of data.
And this this has many different impacts aside from the fact of it's basically create almost creating
like a bigger dataset out of it.
It allows a convolutional neural net to look at important features in an image because as you can see
in this example, here we're rotating.
We're doing color changes, we're adding noise or blurring where to miss this upside down.
But one thing you can see that has been consistent in all these images is the orientation of the eyes
and nose, and that is as well.
So if you use all these augmentations of this image and we have a lot of images in the training dataset
as well, the CNN is going to learn to figure out that whatever class Tiss belongs to, what it's going
to learn the important features that belong to this class.
What I'm trying to say.
So data augmentation, variety, there's actually lots of different augmentation techniques, but Keras
and PyTorch provide built in data augmentation functions, which offer many image manipulations.
These are some common ones here.
You have flipping the images vertically or horizontally, as we saw before.
Brightness, contrast, changing rotations, zooming in, cropping, sharing and skewing.
All of these things are available built into by torching cameras.
It's quite convenient.
So here's a bit more on data.
Augmentations de documentations are only done on our training dataset.
In most standard implementations, we aren't creating new data.
This is this is something to be careful about.
What we're doing is that every mini batch looting.
Remember, in PyTorch, we have to create a what transforms and our transforms are passed to the data
loader.
That's because every time we load a mini batch and pay and it's assuming cameras, you just you don't
see too many batch loading.
There's a lot of process in cameras, but every time we're passing a mini batch, we're applying a set
of random data augmentations.
We I mean, we can apply a random set of data augmentations to those images, hence changing them up.
What this does is that every time CNN sees these groups of images, it's going to see a slightly different
version of those images in the training process.
So that's a very good thing, basically, that we have this ad almost like expanding a dataset without
expanding it.
And as I said, good cameras and pie, too much of a built in functions that allow us to do this.
And there are also libraries.
A very, very good library is called abominations.
It provides almost 100 different augmentation types, some very advanced modern ones as well.
So you can use this as well in place of your in the integrated mode as well for by touch.
So we'll stop there and will now move on to early stopping, which is another useful regularization
technique.
It's quite simple to understand this one as well.
So I'll see you in the next lesson.
Thank you.