1
00:00:00,690 --> 00:00:06,960
Now, let's take a look at a very important regularization technique, and that's called data augmentation.

2
00:00:07,440 --> 00:00:08,940
So let's take a look at this.

3
00:00:09,630 --> 00:00:16,170
So the documentation, as I said, is one of the most effective ways of reducing overfitting in a convolutional

4
00:00:16,170 --> 00:00:19,890
neural network or in any general neural network or machine learning algorithm.

5
00:00:20,550 --> 00:00:21,960
It solves a problem here.

6
00:00:22,110 --> 00:00:27,240
It solves a problem of not having enough data or not having enough variation in your dataset.

7
00:00:27,630 --> 00:00:31,830
And I'll explain to you how it does that and naturally imitate assets.

8
00:00:31,860 --> 00:00:37,100
I'll explain why let themselves naturally to applying data augmentation techniques.

9
00:00:37,110 --> 00:00:40,260
And that's because what is data augmentation?

10
00:00:40,710 --> 00:00:44,850
Imagine we have an image like this that's being fed into a neural network.

11
00:00:45,390 --> 00:00:51,240
However, this is an image and as you know, from open TV or even from Photoshop, Instagram filters

12
00:00:51,240 --> 00:00:52,110
all of those things.

13
00:00:52,560 --> 00:00:58,710
You can apply a lot of different variations to one particular image in the play of basically an infinite

14
00:00:58,710 --> 00:00:59,790
amount of variations.

15
00:01:00,480 --> 00:01:02,310
You can get all of these things here you can.

16
00:01:02,820 --> 00:01:04,200
This is called flip up.

17
00:01:04,590 --> 00:01:06,000
This one is just a bit blurry.

18
00:01:06,030 --> 00:01:08,640
This one is zoomed in a bit, as you can see.

19
00:01:08,910 --> 00:01:13,440
There are many, many, many image augmentations or data augmentations.

20
00:01:13,440 --> 00:01:14,130
You can apply.

21
00:01:14,700 --> 00:01:15,840
So what does this do?

22
00:01:16,620 --> 00:01:24,060
Well, what it does is it effectively makes the neural net to accomplish a neural net see a much wider

23
00:01:24,060 --> 00:01:25,170
variety of data.

24
00:01:25,620 --> 00:01:32,550
And this this has many different impacts aside from the fact of it's basically create almost creating

25
00:01:32,550 --> 00:01:34,530
like a bigger dataset out of it.

26
00:01:34,950 --> 00:01:40,410
It allows a convolutional neural net to look at important features in an image because as you can see

27
00:01:40,410 --> 00:01:43,320
in this example, here we're rotating.

28
00:01:43,320 --> 00:01:49,230
We're doing color changes, we're adding noise or blurring where to miss this upside down.

29
00:01:49,530 --> 00:01:55,980
But one thing you can see that has been consistent in all these images is the orientation of the eyes

30
00:01:55,980 --> 00:01:57,960
and nose, and that is as well.

31
00:01:58,560 --> 00:02:04,350
So if you use all these augmentations of this image and we have a lot of images in the training dataset

32
00:02:04,350 --> 00:02:11,370
as well, the CNN is going to learn to figure out that whatever class Tiss belongs to, what it's going

33
00:02:11,370 --> 00:02:13,860
to learn the important features that belong to this class.

34
00:02:14,100 --> 00:02:14,910
What I'm trying to say.

35
00:02:15,900 --> 00:02:21,900
So data augmentation, variety, there's actually lots of different augmentation techniques, but Keras

36
00:02:21,900 --> 00:02:27,080
and PyTorch provide built in data augmentation functions, which offer many image manipulations.

37
00:02:27,090 --> 00:02:28,500
These are some common ones here.

38
00:02:28,890 --> 00:02:33,540
You have flipping the images vertically or horizontally, as we saw before.

39
00:02:34,050 --> 00:02:39,930
Brightness, contrast, changing rotations, zooming in, cropping, sharing and skewing.

40
00:02:39,930 --> 00:02:43,200
All of these things are available built into by torching cameras.

41
00:02:43,200 --> 00:02:44,190
It's quite convenient.

42
00:02:45,120 --> 00:02:46,590
So here's a bit more on data.

43
00:02:46,590 --> 00:02:51,120
Augmentations de documentations are only done on our training dataset.

44
00:02:51,960 --> 00:02:55,710
In most standard implementations, we aren't creating new data.

45
00:02:56,040 --> 00:02:57,780
This is this is something to be careful about.

46
00:02:58,350 --> 00:03:01,560
What we're doing is that every mini batch looting.

47
00:03:02,140 --> 00:03:07,260
Remember, in PyTorch, we have to create a what transforms and our transforms are passed to the data

48
00:03:07,260 --> 00:03:07,650
loader.

49
00:03:08,130 --> 00:03:12,720
That's because every time we load a mini batch and pay and it's assuming cameras, you just you don't

50
00:03:12,720 --> 00:03:13,980
see too many batch loading.

51
00:03:13,990 --> 00:03:19,560
There's a lot of process in cameras, but every time we're passing a mini batch, we're applying a set

52
00:03:19,560 --> 00:03:21,150
of random data augmentations.

53
00:03:21,600 --> 00:03:27,540
We I mean, we can apply a random set of data augmentations to those images, hence changing them up.

54
00:03:27,990 --> 00:03:34,830
What this does is that every time CNN sees these groups of images, it's going to see a slightly different

55
00:03:34,830 --> 00:03:37,410
version of those images in the training process.

56
00:03:37,890 --> 00:03:43,080
So that's a very good thing, basically, that we have this ad almost like expanding a dataset without

57
00:03:43,080 --> 00:03:43,800
expanding it.

58
00:03:44,400 --> 00:03:49,350
And as I said, good cameras and pie, too much of a built in functions that allow us to do this.

59
00:03:49,710 --> 00:03:51,000
And there are also libraries.

60
00:03:51,000 --> 00:03:53,610
A very, very good library is called abominations.

61
00:03:53,910 --> 00:04:00,030
It provides almost 100 different augmentation types, some very advanced modern ones as well.

62
00:04:00,630 --> 00:04:06,300
So you can use this as well in place of your in the integrated mode as well for by touch.

63
00:04:07,050 --> 00:04:14,520
So we'll stop there and will now move on to early stopping, which is another useful regularization

64
00:04:14,520 --> 00:04:14,910
technique.

65
00:04:14,910 --> 00:04:16,920
It's quite simple to understand this one as well.

66
00:04:17,340 --> 00:04:18,870
So I'll see you in the next lesson.

67
00:04:18,990 --> 00:04:19,470
Thank you.
