1
00:00:00,880 --> 00:00:06,400
Will now discuss on Lesson five, Project two, still on justifying hand gestures with accelerometer.

2
00:00:06,760 --> 00:00:13,150
But for this lesson, we'll be specifying on model training and development in the last lesson.

3
00:00:13,210 --> 00:00:18,250
We briefly used the spectral analysis of lock to process data for this time.

4
00:00:18,640 --> 00:00:19,610
We will use it more.

5
00:00:20,110 --> 00:00:26,890
Slice your data those smaller windows and apply Buttonwood filters first for your joints, forms and

6
00:00:26,890 --> 00:00:30,220
other tools for spectral analysis of each one.

7
00:00:30,730 --> 00:00:37,480
Now here, each window of each data access is transformed and Barbara edges are calculated on each one.

8
00:00:37,840 --> 00:00:39,460
This gives the following features.

9
00:00:40,770 --> 00:00:47,700
Now for values after Butterworth filter, normally depending on the filter type of light from low base

10
00:00:47,700 --> 00:00:50,130
or high pass, it's more than the signal.

11
00:00:51,320 --> 00:00:56,600
For big in frequency domain here, you can specify the number of peaks.

12
00:00:57,050 --> 00:00:59,090
Here you can see on the illustration.

13
00:00:59,390 --> 00:01:03,890
Now these are the most prominent frequencies in that window of data.

14
00:01:04,430 --> 00:01:07,700
And then we have spectral power of peaks here.

15
00:01:08,120 --> 00:01:11,540
This is the amplitude of frequency at the peaks.

16
00:01:12,320 --> 00:01:14,540
Like how powerful is the signal?

17
00:01:14,840 --> 00:01:20,930
The spectral analysis is actually best for data that has a lot of things that happen at the same time.

18
00:01:21,830 --> 00:01:27,800
The accelerometer motion are, to some extent, the audio signal, vibration and so on.

19
00:01:28,340 --> 00:01:35,000
It doesn't work well with data that doesn't have any repeating elements, which is why it didn't work

20
00:01:35,000 --> 00:01:37,010
well for data in the previous project.

21
00:01:37,640 --> 00:01:45,610
So in preparation, we need to make sure you're using our doing not I.D. that has greater done 1.9 version,

22
00:01:46,190 --> 00:01:50,270
set up the training you need and then start to think about what you want to do next.

23
00:01:50,900 --> 00:01:53,660
Take the raw data and slice it into smaller windows.

24
00:01:54,320 --> 00:02:00,470
Use signal processing blocks to find features and then use a learning block to classify new data.

25
00:02:01,280 --> 00:02:03,590
There are signal processing and learning blocks.

26
00:02:04,010 --> 00:02:10,610
Signal processing blocks always return the same values for the same input, and somehow they are used

27
00:02:10,610 --> 00:02:13,550
to make raw data easier to process.

28
00:02:14,150 --> 00:02:20,870
Learning blocks learn from their past experiences, and then signal processing, called spectral analysis,

29
00:02:21,320 --> 00:02:22,820
will be used in this lesson.

30
00:02:23,180 --> 00:02:30,170
Now this block filters the signal before spectral analysis on it, and it also gets the frequency and

31
00:02:30,170 --> 00:02:31,970
spectral power from data from it.

32
00:02:32,690 --> 00:02:40,760
Then we'll use a neural network in learning block that takes the spectral features and learns to distinguish

33
00:02:40,760 --> 00:02:44,780
between the three, the idle, the shake, the and with classes.

34
00:02:45,650 --> 00:02:53,570
Now, to make an impulse, go to the studio and click on Create Impulse, then set the window size to

35
00:02:53,570 --> 00:03:01,480
two thousand and window to eight and add the spectral analysis and kuras blocks to save the impulse.

36
00:03:02,030 --> 00:03:03,710
Click the save impulse button.

37
00:03:03,950 --> 00:03:10,040
On this slide, you would see the times to use data where you can adjust the window size and spectral

38
00:03:10,040 --> 00:03:17,630
analysis, where you can input spectral features such as axis and the neural network areas where you

39
00:03:17,630 --> 00:03:21,290
can input classifiers or more special features.

40
00:03:21,860 --> 00:03:26,780
And then you would see the output features now to configure your signal processing block.

41
00:03:27,260 --> 00:03:30,890
Click on these spectral features in the menu on the left side.

42
00:03:31,370 --> 00:03:34,820
Now this will show you the raw data on top of the screen.

43
00:03:34,940 --> 00:03:42,080
You can select other files via the dropdown menu and the results of the signal processing through drops

44
00:03:42,080 --> 00:03:43,970
on the right now.

45
00:03:43,970 --> 00:03:51,890
For the Spectral Features Block, you'll see the following groups after filter the signal after applying

46
00:03:51,890 --> 00:03:52,970
a low pass filter.

47
00:03:53,180 --> 00:03:58,760
This will remove noise frequency domain, the frequency at which signal is repeating.

48
00:03:59,280 --> 00:04:04,370
Example making one wave movement per second will show one peak at one hertz.

49
00:04:05,270 --> 00:04:12,560
Then also, we have spectral power, the amount of power that went into the signal at each frequency.

50
00:04:13,200 --> 00:04:18,080
A good signal processing block will yield similar results for similar data.

51
00:04:18,650 --> 00:04:25,160
If you move the sliding window on the raw data, drop around the drops should remain similar.

52
00:04:25,310 --> 00:04:31,390
Also, when you switch to another file with the same label, you should see similar drops.

53
00:04:31,460 --> 00:04:37,790
Even if the orientation of the device was different on this line, you would see these raw features.

54
00:04:38,090 --> 00:04:42,320
This is actually you one window of data before processing.

55
00:04:43,300 --> 00:04:47,800
And then after processing, you would see the process features.

56
00:04:48,310 --> 00:04:52,780
Now here are the process features data you would see on this slide.

57
00:04:53,350 --> 00:04:57,370
And then once you're happy with the result, you can now click See Parameters.

58
00:04:57,940 --> 00:05:00,670
This will send you to the Future Generation scheme.

59
00:05:01,660 --> 00:05:07,720
In here, you'll be able to split all the raw data up in windows based on the window size and the window

60
00:05:07,720 --> 00:05:14,110
increase, and then you'll be able to apply the spectral features block on all of this windows.

61
00:05:14,470 --> 00:05:17,590
So first, generate features to start the process.

62
00:05:18,370 --> 00:05:22,590
Then right after that, the feature explorer will open up.

63
00:05:22,690 --> 00:05:28,010
Now this is actually a drop of all the features that were found against all the windows that were made.

64
00:05:28,810 --> 00:05:34,810
People who compare all of their data with this drop will see how well they did, for example, by blocking

65
00:05:34,810 --> 00:05:41,470
the height of the first speak on the x axis against the spectral power between 0.5 hertz and one hertz

66
00:05:41,800 --> 00:05:42,880
on the y axis.

67
00:05:43,420 --> 00:05:51,130
So basically, as a general rule, if you can separate the data on the number of axis, then the machine

68
00:05:51,130 --> 00:05:54,430
learning model will be able to do the same thing as well.

69
00:05:55,180 --> 00:05:58,120
So with all the data process, it's time to start training.

70
00:05:58,120 --> 00:06:04,570
A neural network in neural networks are a group of algorithms that aren't very different from the human

71
00:06:04,570 --> 00:06:04,840
brain.

72
00:06:05,530 --> 00:06:08,200
They are somehow designed to recognize patterns.

73
00:06:08,500 --> 00:06:14,440
And in this case, we're going to train a network that will take the signal processing data as an input

74
00:06:14,440 --> 00:06:17,920
and try to figure out which of these three classes it fits into.

75
00:06:18,550 --> 00:06:23,260
So the question is, how does a neural network figure out what to do next?

76
00:06:23,680 --> 00:06:27,940
A neural network is made up of layers of neurons that are all connected.

77
00:06:28,300 --> 00:06:29,980
Each connection has a weak.

78
00:06:30,280 --> 00:06:36,190
You need to know that one such neuron in the input layer would be the height of the first peak of the

79
00:06:36,190 --> 00:06:39,970
x axis from the signal processing block.

80
00:06:40,840 --> 00:06:46,240
And when you set up a neural network, all of these connections are set up at random.

81
00:06:46,660 --> 00:06:50,860
This means that the neural network will make random predictions.

82
00:06:51,310 --> 00:06:53,350
Take all the real data during training.

83
00:06:53,830 --> 00:07:00,430
We ask the network to make a prediction, and if it doesn't work out, we make small changes to week.

84
00:07:01,180 --> 00:07:07,810
Now, in this way, after a lot of trials, the neural network will learn and it will become a better

85
00:07:07,810 --> 00:07:09,850
at predicting new data in the long run.

86
00:07:10,210 --> 00:07:17,230
Now click on the end in Classifier in the middle to see how this works and then set the number of training

87
00:07:17,230 --> 00:07:18,070
cycles to one.

88
00:07:18,700 --> 00:07:24,700
This will only allow for one round of training, and as soon as you're done, click the Start training

89
00:07:24,700 --> 00:07:25,090
button.

90
00:07:25,570 --> 00:07:31,990
On this slide, you would see your last training performance, the level of your accuracy, your loss

91
00:07:32,230 --> 00:07:33,370
and the classes.

92
00:07:34,000 --> 00:07:41,740
Also, you would be able to see the on device performance, your inference time, your memory usage

93
00:07:41,740 --> 00:07:43,600
and your model binary size.

94
00:07:44,590 --> 00:07:50,050
No change in the number of training cycles to two, and you'll see performance will go up.

95
00:07:50,500 --> 00:07:57,820
Then finally change the number of training cycles to 100 or more and let training finish be just doing

96
00:07:57,820 --> 00:07:59,260
your first neural network.

97
00:07:59,710 --> 00:08:05,650
Now, it's important to take note that you might end up with the 100 percent accuracy after training

98
00:08:05,650 --> 00:08:07,330
for 100 training cycles.

99
00:08:07,900 --> 00:08:14,200
This is not necessarily a good thing, as it might be a sign that the neural network is too tuned for

100
00:08:14,200 --> 00:08:21,730
the specific test set and might performed poorly on new data, which is overfitting now.

101
00:08:21,730 --> 00:08:29,320
The best way to reduce this is by adding more data now adding jump out block or reducing the learning

102
00:08:29,320 --> 00:08:29,560
rate.

103
00:08:30,310 --> 00:08:36,880
With the impulse design train and improving the work, you can put this model back on your device when

104
00:08:36,880 --> 00:08:39,190
the model runs without an internet connection.

105
00:08:39,580 --> 00:08:42,460
Latency is kept to a minimum in power.

106
00:08:42,460 --> 00:08:45,880
Consumption is kept to a minimum, and this makes it run.

107
00:08:47,230 --> 00:08:54,340
After you click on deployment, Bob, just the adrenal library and downloaded removed the archive and

108
00:08:54,340 --> 00:08:56,350
put it in your adrenal library folder.

109
00:08:57,010 --> 00:09:05,170
Open the Arduino IDE and choose examples, then choose the name of your project in surgery and she must

110
00:09:05,350 --> 00:09:12,520
then choose Nanobody 33 cents accelerometer sketch, which is the one for your project.

111
00:09:12,970 --> 00:09:20,260
Now, it looks like the adrenal nano DL 33 cents, but it has a different accelerometer, which is the

112
00:09:20,710 --> 00:09:24,730
Alliés 3D HDR stand off Alice M9.

113
00:09:25,030 --> 00:09:32,830
The S1 so will need to change the data acquisition section to make it work with our board because View

114
00:09:32,840 --> 00:09:36,940
Terminal has an LCD screen with showed the name of a class that was found.

115
00:09:36,940 --> 00:09:43,840
If this class confidence value is above a certain level, then change initialization instead of function

116
00:09:44,410 --> 00:09:47,740
due the data collection and inference within loop function.

117
00:09:47,980 --> 00:09:55,060
Here, you can see, is where we need to change data acquisition with A. m9 S1 data acquisition function

118
00:09:55,060 --> 00:10:04,210
for Ellie S3, the HDR, and then to display that last name on the LCD screen after you need to do it

119
00:10:04,210 --> 00:10:04,780
like this.

120
00:10:05,980 --> 00:10:13,330
Now, add the following code block in which we check confidence values of every class, and if one of

121
00:10:13,330 --> 00:10:20,020
them is higher than the threshold, change the color of the screen and display the classic theme, then

122
00:10:20,020 --> 00:10:24,490
compile and upload, open the serial monitor and perform one of the gestures.

123
00:10:25,090 --> 00:10:31,090
You will be able to see the inference results displayed on the serial monitor and also on the LCD screen.

124
00:10:31,630 --> 00:10:39,130
Here you can see an actual photo or illustration on the code gestures that we have used earlier.

125
00:10:39,880 --> 00:10:43,780
Another illustration on how we use the code.

126
00:10:44,680 --> 00:10:47,980
So basically, we need to retrieve model for another gestures.
