【Badminton training monitor project】--main function realization
[Copy link]
Last week, the online defense finally ended, and I officially changed from a graduate student to a social animal, starting a new home quarantine life. . . Yes, the "Jiajiangmian" village was attacked by the new coronavirus. We originally planned to return to school on the 24th to get the certificate, but now we can only stay at home ...
I can calm down these few days and complete my "Badminton Training Monitor" project. In fact, I have already had a basic understanding and experience of FSM and MLC in the early stage . I am thinking of using the development board to implement the main functions in one or two days, and then combine them to complete the project. Congratulations ~
However, when I started the data collection training test of the project according to my previous understanding, I found that I did not understand how to use MLC.
The following is the main text of this post.
First, let me show you a video of today's recognition. After many times of collection and testing, the success rate is finally relatively stable:
As you can see from the video, when I swing the badminton racket with the development board attached, the MLC under the data interface of Unico can correctly identify my current swing action. For example, if I swing from top to front , 12 will appear , if I swing from bottom to front, 4 will appear, and if I swing from left to front, 8 will appear . This shows that the main functions of the project have been realized . It's just that the stability is slightly poor, but this stability is related to the execution principle of MLC . My hand has been useless.
Next, I will share the process of implementing the above functions starting from collecting data. During this process, I also gradually re-recognized the MLC module.
The purpose of my project is to monitor the swinging of a badminton racket. In the post I briefly introduced the classification of swinging.
At the beginning, I used Unico 's Polts interface to preliminarily analyze the sensor range parameters required to swing a badminton racket.
That is to say, during the waving process, the data should not be distorted and the sampling frequency should be sufficient .
Then based on the above indicators, I finally determined a set of parameters:
- Accelerometer resolution: 8G
- Accelerometer output frequency : 104Hz
- Angular velocity meter resolution: 1000dps
- Angular velocity meter output frequency: 104Hz
So based on the above parameters, I started collecting motion data.
----------------------------- There are problems in this part, it is just for sharing records, please do not refer to it --------------------------------------------------
I first collected data for an hour using the collection method in my previous post , and then repeated the data collection many times, until my hands almost broke from waving them:
I kept three swings: swinging from bottom to front, smashing from top to front, and hitting back from left to front. I collected 25+ data sets for each action, and used the small tool I wrote before to perform region cropping on the data set, removing the idle segments before and after the action in the data. Then I imported them into Unico's MLC interface one by one , like this :
Finally, after importing all the data, I started to configure the parameters of MLC. Everything was done according to the previous method. I set the previous parameters: (The software version in the interface is 9.8.1.0, which seems to support batch import, but I didn’t make it work)
When exporting the training file, there was a problem ... The software crashed!!! All the data records imported before were gone, so I tried again two or three times, and rolled back the software to 9.7.1.0 and tested it several times. A day passed like this ... I once suspected that it was a problem with my parameter settings, or a bug in the new version of the software , or a problem with the data set collection...
Finally, when I was about to lose all my hunger and wanted to eat lunch, I was lazy and found that after importing a small amount of data, I could generate a training file. This shows that… my nearly 80 data sets are too many … causing the software to crash. . . . Uh, what about the machine learning training? Don’t I need more data sets? . . .
----------------------------- End dividing line of failed test results -----------------------------------------------------
After dinner, I re-organized my thoughts. After reading the official tutorial for the second time, I found that there were only three data sets for the three actions in the official tutorial? ?
And in the data collection interface, you can see that basically one action is repeated many times:
At this time, I thought about the window width parameters that I would set later, and suddenly I understood.
Previously, I was limited by the deep network thinking of graduate students. The training set used loss to train the network weights... which required a large number of data sets for calculation. MLC is machine learning. It uses data statistics to summarize the characteristic value characteristics of the action , thereby realizing classification operations. . .
That is to say, the data set we collected contains a lot of repeated data of the same action, and the amount of data for each action is just within the window width range . In this way, Unico can automatically split the data set interval according to the window width and calculate the statistical eigenvalues. This also explains why the official tutorial reminds: Pay attention to the correct start and stop of data logs, and you must start the action before it is started and stop it before the action is completed , so that the sliding window will not be misplaced and the wrong data will be calculated.
From this perspective, there are problems with the data set and training method I wrote earlier.
So I collected the data again, swinging the racket in the same action multiple times in one data set, and collected a new data set. (Although the training method written earlier was wrong, the little tool I wrote can still process the data set before and after at this time~)
It can be seen that the collected and processed data waveform is shown in the figure:
It contains 25 actions, each of which takes about 70 samples, so the window width can be set to around this value.
After collecting data sets of multiple actions, import them into Unico's MLC one by one
The picture above shows what it looks like after importing, where down means swinging from the bottom to the front, left means swinging from the left to the front, up means swinging from the top to the front, and stand means there is no movement. Then you can set the parameters.
In the feature parameters, its purpose is to find and count the differences between different actions through the selected feature values, so the feature value parameters can be selected first, and then counted by Weka. The final decision tree will show that only those feature values are used, and then reset the configuration again. The purpose of this is mainly because the sensor memory is limited. If too many feature values are selected here, it will occupy memory, so just use an appropriate amount~
Then click Next, save the arff file, and set the results. The official instructions recommend that it should be a multiple of 4 for the subsequent meta-filter, but I tried 1234 and it worked, mainly because I didn’t understand the role of the subsequent meta-filter.
Next, open the arff file just generated and generate a decision tree according to the method in the post.
Get the decision tree file:
You can generate the configuration file
After saving the configuration file, import the ucf file in unico and the MLC module will be started successfully.
Then you can see the output effects when performing different actions in the data interface~
Although the recognition efficiency is average, it basically realizes the function of MLC to recognize the swing action .
At this point, my project.....oh no, my left hand has blisters.
|