Skip to content

Commit 9afc792

Browse files
committed
har_trees: Improve README a bit
1 parent e9facf1 commit 9afc792

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed

examples/har_trees/README.md

+38-8
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ Working. Tested running on ESP32 with MicroPython 1.24.
1818

1919
**NOTE:** This is primarily *example* code for a Human Activity Recognition,
2020
not a generally-useful pretrained model.
21-
The dataset used is rather simple, and may not reflect the data you get from your device
22-
- which will lead to poor classifications.
23-
For a real world usage you should probably replace the dataset with your own data, collected on your own device.
21+
The dataset used is rather simple, and may not reflect the data you get from your device.
22+
Such data mismatch will often lead to poor classification results.
23+
For a real world usage you should aim to replace the dataset with your own data, collected on your own device.
24+
Or alternatively use a large and diverse dataset from a multiple users, devices and scenarios.
2425

2526
At the bottom on the README there are some instructions and tools for collecting your own data,
2627
and training a custom model on such a dataset.
@@ -32,19 +33,24 @@ This example uses an approach based on the paper
3233
For each time-window, time-based statistical features are computed,
3334
and then classified with a RandomForest model.
3435

35-
## Dataset
36+
## Dataset 1: Common activities (UCI HAR)
37+
3638
The example uses the [UCI-HAR dataset](https://www.archive.ics.uci.edu/dataset/341/smartphone+based+recognition+of+human+activities+and+postural+transitions).
3739
The classes are by default limited to the three static postures (standing, sitting, lying) plus three dynamic activities (walking, walking downstairs, walking upstairs).
3840
The data is from a waist-mounted smartphone.
3941
Samplerate is 50Hz.
4042
By default only the accelerometer data is used (not the gyro).
4143

44+
![UCI HAR classes](./img/UCI-HAR-dataset.png)
45+
46+
## Dataset 2: Excercise detection (custom)
4247

43-
## TODO
48+
This dataset was collected using the data recording tools described further below.
49+
The data contains 3 kinds of exercises, plus "other" non-exercise activity.
50+
The classes are: Jumping Jacks, Squats, Lunges, Other.
51+
The data was collected using an M5Stick C PLUS 2, mounted on the wrist like a watch (button facing forward).
4452

45-
- Add an illustrative image
46-
- Run the training + test/evaluation in CI
47-
- Add demonstration on LilyGo T-Watch 2020 (BMA423 accelerometer)
53+
![Exercise detection](./img/har_exercises_classes.png)
4854

4955

5056
## Running on host
@@ -118,6 +124,23 @@ Run the classification
118124
mpremote har_live.py
119125
```
120126

127+
This will continiously output the results of the classification,
128+
and count the time spent in each class.
129+
130+
```
131+
classify other [0.0, 0.0, 1.0, 0.0] 216 ms
132+
133+
jumpingjack: 6 seconds
134+
lunge: 0 seconds
135+
other: 34 seconds
136+
squat: 0 seconds
137+
138+
ble-advertise mac=10061c172302 data=aa0100050000ff00
139+
```
140+
141+
The device also sends the classifications out as Bluetooth Low Energy advertisements.
142+
See the code for how the data is encoded used.
143+
This cata can be received on a smartphone or computer, for tracking and storage.
121144

122145
## Run training
123146

@@ -150,6 +173,13 @@ This example provides some basic tools to assist with this process.
150173
Recording data. Requires a M5StickC PLUS 2.
151174
Before you do this, make sure to **first run live classification example** (to get the dependencies).
152175

176+
Copy additional dependencies
177+
```
178+
mpremote cp recorder.py :
179+
```
180+
181+
182+
Run the recording program
153183
```
154184
mpremote run har_record.py
155185
```
34.9 KB
Loading
Loading

0 commit comments

Comments
 (0)