The motion of poi has three degrees of freedom. As shown in the free body diagram, the poi head moves in the X, Y, and Z planes. Acceleration is the most important data point in our classification system because we are categorizing motions that are either continuous or have sharper changes in motion. Those sharper changes in motion should result in more changes in acceleration, while continuous motion should generally have a lower frequency. Because the two different styles we are analyzing can cover a wide variety of tricks in different planes, it’s important that we gather data in all three planes. However, the y-acceleration likely has the most impact because that axis is always aligned with the normal acceleration being experienced by the poi. Z-acceleration is also relevant, as the poi typically travels in that direction during trick transitions. We chose to look at all the acceleration data because we are processing our data and analyzing it through a machine learning model, making it not meaningfully more difficult to look at all our acceleration data.
Data Collection & Preparation
To collect the motion data used to train our classifier, we used an app called Phyphox, which measures acceleration data. By taping a phone to a poi head, we were able to measure the x,y,z, and absolute acceleration caused by the motion of the poi.
Before we analyzed our data, we trimmed off the first and last five seconds. This was to ensure that our data maximized time spent spinning, and cut off the parts where we were starting and stopping the recording.
Frequency Analysis
To create our classifier, we used the Discrete Fourier Transform to look at the spinning signal in the frequency domain as opposed to the time domain. By looking at the frequency domain, we capture more variability, creating a more accurate classifier.
The Discrete Fourier Transform breaks down a signal into its component frequencies and their corresponding magnitudes, like so:
Fig 1: a frequency graph obtained using the Discrete Fourier Transform on the y-acceleration data of a poi head
Frequencies with a larger magnitude of amplitude can be considered characteristic frequencies, and can be used to characterize the motion of a poi head or person because they are more prevalent.
The matrix that describes this transformation can be written as:
In this matrix, N is the number of points in our time domain data. We multiply by the 1/sqrt(N) to normalize data of different lengths. Multiplying this matrix by our time domain data results in our frequency data. We accomplished this in Matlab using the Fast Fourier Transform function (fft) and multiplying it by 1/sqrt(N).
Filtering
Using Matlab’s built in high pass filter, we filtered out frequencies between -0.01Hz and 0.01Hz. This was to remove the peak frequency of 0 Hz that occurs as an artifact of the FFT. The magnitude of 0 Hz confused our classifier so it was removed to focus on the characteristic frequencies of each style.
Fig 2: time graphs (above) and frequency graphs (below), raw absolute acceleration data (left) vs. filtered absolute acceleration data (right)
After applying the Discrete Fourier Transform and filtering, we extracted the peak and mean frequencies of the poi data to improve the performance of and reduce the size of the data being input to the classifier.
To obtain the peak frequency, we found the frequency with the greatest magnitude. For mean frequency, we calculated the power of each frequency then divided the sum of the products of the frequencies and their corresponding power by the sum of all the powers. The power of each frequency was calculated by squaring the normalized real value of the corresponding FFT value of that frequency.
Fig 3: Power equation (above) and mean frequency equation (below). x is the real FFT value of a specific frequency and N is the number of points.
Fig 4: Frequency graph marked with mean (1.4207 Hz) and peak (0.0237 Hz) frequency.
Before training the classifier on these features we noticed some general trends. The mean frequency of the stally data was often higher than the flowy data. Since we’re analyzing acceleration, this makes sense, as stalls result in more changes in velocity, meaning greater acceleration. A flowy style often has a more constant velocity which explains why the mean frequency of these data points was smaller. Meanwhile, the peak frequency of the stally data was lower. When applying varying jerks to the accelerometer (Phyphox), the greater the jerk the lower the peak frequency. Since stalls involve switching directions, or greater jerk, this explains why the stally data generally had lower peak frequencies.
Fig 5: Time and frequency domain plots of flowy signal (left) and stally signal (right)
Classification
To build the spinning style machine learning model, we used the MATLAB Statistics and Machine Learning Toolbox to implement a linear discriminant analysis (LDA) model since we are dealing with a binary classification problem. The two classes are flowy or stally. The LDA model was ideal because it is simple and computationally efficient, which works since there are only two classes, and due to our small set of training data, with which it can still work well.
The classifier was trained on ten sets of features, five flowy and five stally. When tested on two sets of external features it classified both correctly, the first as flowy and the second as stally.