@@ -12,7 +12,7 @@ docker run --rm --volume $PWD/paper:/data --user $(id -u):$(id -g) --env JOURNAL
1212## Runnable example
1313
1414There is a plot in the paper,
15- that demonstrates using emlearn_fft and emlearn_trees from emlearn-micropython
15+ that demonstrates using ` emlearn_fft ` and ` emlearn_trees ` modules from emlearn-micropython
1616to do Human Activity Recognition.
1717
1818The MicroPython code is found in:
@@ -21,13 +21,14 @@ The MicroPython code is found in:
2121
2222The following Python files are used for support:
2323
24- - [ create_plot.py] ( create_plot.py )
25- - [ processing.py] ( processing.py )
26- - [ plotting.py] ( plotting.py )
27- - [ extract_data.py] ( extract_data.py )
24+ - [ create_plot.py] ( create_plot.py ) - Top-level script/entrypoint
25+ - [ processing.py] ( processing.py ) - Running MicroPython in subprocess on sensor data
26+ - [ plotting.py] ( plotting.py ) - Plotting of data using Plotly
27+ - [ extract_data.py] ( extract_data.py ) - Extracting example data from PAMAP2 dataset
2828
2929### Prerequities
3030
31+ - Linux, Mac OS or Windows Subsystem for Linux (WSL)
3132- Python 3.10 or later
3233- [ MicroPython, Unix port] ( https://github.com/micropython/micropython/tree/master/ports/unix ) .
3334
@@ -39,16 +40,56 @@ pip install plotly numpy pandas scikit-learn emlearn setuptools pyarrow kaleido
3940
4041### Install MicroPython modules
4142
43+
44+ ### Runing
45+
46+ #### Running using native modules
47+
48+ NOTE: not supported on Mac OS (due to https://github.com/micropython/micropython/issues/5500 ). See other method
49+
50+ Install the modules
4251```
4352micropython -m mip install github:jonnor/micropython-npyfile
4453micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emlearn_trees.mpy
4554micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emlearn_fft.mpy
4655```
4756
48- ### Run it
57+ Run the script
58+ ```
59+ python create_plot.py
60+ ```
61+
62+ Should update the file ` physical_activity_recognition_pipeline.png ` .
63+
64+
65+ #### Running using custom micropython executable
66+
67+ The modules in emlearn-micropython can be bundled into the ` micropython ` executable.
68+ This is the only method that works on Mac OS at the moment.
4969
70+ Alternative 1: Download prebuilt binary (Mac OS)
5071```
72+ curl -o micropython https://emlearn.github.io/emlearn-micropython/builds/master/ports/macos/micropython
73+ ```
74+ Alternative 1: Download prebuilt binary (Linux)
75+ ```
76+ curl -o micropython https://emlearn.github.io/emlearn-micropython/builds/master/ports/linux/micropython
77+ ```
78+
79+ Alternative 2: Use locally built micropython Unix port. Must first be built per [ developing.md] ( https://github.com/emlearn/emlearn-micropython/blob/master/docs/developing.md#run-tests-on-pc-using-external-modules-build ) .
80+ ```
81+ cp ../dist/ports/*/micropython ./
82+ ```
83+
84+
85+ Install modules and run script
86+ ```
87+ export PATH=./:$PATH
88+ echo which micropython
89+ curl -o npyfile.py https://github.com/jonnor/micropython-npyfile/raw/refs/heads/master/npyfile.py
5190python create_plot.py
5291```
5392
5493Should update the file ` physical_activity_recognition_pipeline.png ` .
94+
95+
0 commit comments