Collecting training data

We can now use the collector to collect training data for activity recognition. The collector supports three activities by default, standing, walking, and running, as shown in the following screenshot.

You can select an activity, that is, target class value, and start recording the data by clicking the START COLLECTING button. Make sure that each activity is recorded for at least three minutes; for example, if the Walking activity is selected, press START COLLECTING and walk around for at least three minutes. At the end of the activity, press Stop collecting. Repeat this for each of the activities.

You could also collect different scenarios involving these activities, for example, walking in the kitchen, walking outside, walking in a line, and so on. By doing so, you will have more data for each activity class and a better classifier. Makes sense, right? The more data, the less confused the classifier will be. If you only have a little data, overfitting will occur and the classifier will confuse classes—standing with walking, walking with running, and so on. However, the more data, the less they get confused. You might collect less than three minutes per class when you are debugging, but for your final polished product, the more data, the better it is. Multiple recording instances will simply be accumulated in the same file.

Note, the Delete Data button removes the data that is stored in a file on the phone. If you want to start over again, hit Delete Data before starting; otherwise, the new collected data will be appended at the end of the file:

The collector implements the diagram discussed in the previous sections: it collects accelerometer samples, computes the magnitudes, uses the FFT.java class to compute the coefficients, and produces the feature vectors. The data is then stored in a Weka-formatted features.arff file. The number of feature vectors will vary based on the amount of data you collect. The longer you collect the data, the more feature vectors are accumulated.

Once you stop collecting the training data using the collector tool, we need to grab the data to carry on the workflow. We can use the file explorer in Android Device Monitor to upload the features.arff file from the phone and to store it on the computer. You can access your Android Device Monitor by clicking on the Android robot icon, as shown in the following screenshot:

By selecting your device on the left, your phone storage content will be shown on the right-hand side. Navigate through mnt/shell/emulated/Android/data/edu.dartmouth.cs.myrunscollector/files/features.arff, as shown in the following screenshot:

To upload this file to your computer, you need to select the file (it is highlighted) and click on Upload.

Now, we are ready to build a classifier.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.105.255