How to import apple core motion dataset in turi create?

209 Views Asked by At

I've recently discovered that apple core motion data (accelerometer, gyroscope etc) can be used to create learning models. The link below shows an example:

https://github.com/apple/turicreate/blob/master/userguide/activity_classifier/introduction.md

This example uses data from a large dataset (HAPT). In my situation I'm the creator of my own dataset using recordings of core motion data while performing different activities (i.e. jumping, walking, sitting). The next step is to import my dataset in turi to create a model. How this can be achieved? Could anyone provide a list of steps to follow?

Thank you

1

There are 1 best solutions below

0
On

Ideally, you would have recorded your motion data into some standard format. Let's assume it is in CSV format.

walking,jumping,sitting
82,309635,1
82,309635,1
25,18265403,1
30,18527312,8
30,17977769,40
30,18375422,37
30,18292441,38
30,303092,7
85,18449654,3

You can read the file using any file reader. To simplify your life, pandas or sframe may rescue you.

In [14]: import turicreate as tc

In [15]: sf = tc.SFrame.read_csv('/tmp/activity.csv')
Finished parsing file /tmp/activity.csv
Parsing completed. Parsed 9 lines in 0.13823 secs.
------------------------------------------------------
Inferred types from first 100 line(s) of file as
column_type_hints=[int,int,int]
If parsing fails due to incorrect types, you can correct
the inferred type list above and pass it to read_csv in
the column_type_hints argument
------------------------------------------------------
Finished parsing file /tmp/activity.csv
Parsing completed. Parsed 9 lines in 0.113868 secs.

In [16]: sf.head()
Out[16]:
Columns:
        walking int
        jumping int
        sitting int

Rows: 9

Data:
+---------+----------+---------+
| walking | jumping  | sitting |
+---------+----------+---------+
|    82   |  309635  |    1    |
|    82   |  309635  |    1    |
|    25   | 18265403 |    1    |
|    30   | 18527312 |    8    |
|    30   | 17977769 |    40   |
|    30   | 18375422 |    37   |
|    30   | 18292441 |    38   |
|    30   |  303092  |    7    |
|    85   | 18449654 |    3    |
+---------+----------+---------+
[9 rows x 3 columns]