CoolFace
Datasetpublic

rnicrosoft/PAMAP2

PAMAP2 The PAMAP2 Physical Activity Monitoring dataset contains data of 18 different physical activities, performed by 9 subjects wearing 3 inertial measurement units and a heart rate monitor. A. Reiss and D. Stricker, "Introducing a New Benchmarked Dataset for Activity Monitoring," 2012 16th International Symposium on Wearable Computers, Newcastle, UK, 2012, pp. 108-109, doi: 10.1109/ISWC.2012.13. Dataset Information The PAMAP2 Physical Activity Monitoring… See the full description on the dataset page: https://huggingface.co/datasets/rnicrosoft/PAMAP2.

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes181downloads
prepare_csv.py49 linesDownload Raw Back to root
1import os
2import pandas as pd
3
4IMU = ["hand", "chest", "ankle"]
5sensors = [
6    "temperature",
7    "acceleration_16g_1",
8    "acceleration_16g_2",
9    "acceleration_16g_3",
10    "acceleration_6g_1",
11    "acceleration_6g_2",
12    "acceleration_6g_3",
13    "gyroscope_1",
14    "gyroscope_2",
15    "gyroscope_3",
16    "magnetometer_1",
17    "magnetometer_2",
18    "magnetometer_3",
19    "orientation_1",
20    "orientation_2",
21    "orientation_3",
22    "orientation_4",
23]
24names = [
25    "timestamps",
26    "activityID",
27    "heart_rate",
28]
29names.extend([f"IMU_{pos}_{s}" for pos in IMU for s in sensors])
30
31for folder in ["Protocol", "Optional"]:
32    for filename in os.listdir(folder):
33        if not filename.rsplit(".")[1] == "dat":
34            print(f"skip {filename}")
35            continue
36        print(f"{folder}/{filename}")
37
38        name = filename.rsplit(".")[0]
39        # df = pd.read_csv()
40        df = pd.read_table(
41            f"{folder}/{name}.dat",
42            sep=r"\s+",
43            header=None,
44            names=names,
45        )
46        df.to_csv(
47            f"{folder}/{name}.csv.zip", na_rep="NaN", index=False, compression="zip"
48        )
49