Datasets:

ArXiv:
License:
File size: 6,259 Bytes
a199a9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

import json
from dataclasses import dataclass, fields
from enum import Enum

"""
Each sequence folder follows the following structure.
Files might be missing if not downloaded. 
  β”œβ”€β”€ LICENSE 
  β”œβ”€β”€ metadata.json
  β”œβ”€β”€ body
  β”‚Β Β  β”œβ”€β”€ xdata_blueman.glb
  β”‚Β Β  β”œβ”€β”€ xdata.healthcheck
  β”‚Β Β  β”œβ”€β”€ xdata.mvnx
  β”‚Β Β  └── xdata.npz
  β”œβ”€β”€ narration
  β”‚Β Β  β”œβ”€β”€ activity_summarization.csv
  β”‚Β Β  β”œβ”€β”€ atomic_action.csv
  β”‚Β Β  └── motion_narration.csv
  β”œβ”€β”€ recording_head / recording_observer
  β”‚Β Β  β”œβ”€β”€ data
  β”‚Β Β  β”‚   β”œβ”€β”€ data.vrs
  β”‚Β Β  β”‚   β”œβ”€β”€ et.vrs
  β”‚Β Β  β”‚Β Β  └── motion.vrs
  β”‚Β Β  └── mps
  β”‚Β Β      β”œβ”€β”€ eye_gaze
  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ general_eye_gaze.csv
  β”‚Β Β      β”‚Β Β  └── personalized_eye_gaze.csv
  β”‚Β Β      └── slam
  β”‚Β Β          β”œβ”€β”€ closed_loop_trajectory.csv
  β”‚Β Β          β”œβ”€β”€ online_calibration.jsonl
  β”‚Β Β          β”œβ”€β”€ open_loop_trajectory.csv
  β”‚Β Β          β”œβ”€β”€ semidense_observations.csv.gz
  β”‚Β Β          β”œβ”€β”€ semidense_points.csv.gz
  β”‚Β Β          └── summary.json
  └── recording_rwrist / recording_lwrist
      β”œβ”€β”€ data
   Β Β  β”‚   β”œβ”€β”€ data.vrs
      β”‚Β Β  └── motion.vrs
      └── mps
          └── slam
              β”œβ”€β”€ closed_loop_trajectory.csv
              β”œβ”€β”€ online_calibration.jsonl
              β”œβ”€β”€ open_loop_trajectory.csv
              β”œβ”€β”€ semidense_observations.csv.gz
              β”œβ”€β”€ semidense_points.csv.gz
              └── summary.json

"""

NYMERIA_VERSION: str = "v0.0"


@dataclass(frozen=True)
class MetaFiles:
    license: str = "LICENSE"
    metadata_json: str = "metadata.json"


@dataclass(frozen=True)
class Subpaths(MetaFiles):
    body: str = "body"
    text: str = "narration"

    recording_head: str = "recording_head"
    recording_lwrist: str = "recording_lwrist"
    recording_rwrist: str = "recording_rwrist"
    recording_observer: str = "recording_observer"

    vrs: str = "data"
    mps: str = "mps"
    mps_slam: str = "mps/slam"
    mps_gaze: str = "mps/eye_gaze"


@dataclass(frozen=True)
class BodyFiles:
    xsens_processed: str = f"{Subpaths.body}/xdata.npz"
    xsens_raw: str = f"{Subpaths.body}/xdata.mvnx"
    momentum_model: str = f"{Subpaths.body}/xdata_blueman.glb"


@dataclass(frozen=True)
class TextFiles:
    motion_narration: str = f"{Subpaths.text}/motion_narration.csv"
    atomic_action: str = f"{Subpaths.text}/atomic_action.csv"
    activity_summarization: str = f"{Subpaths.text}/activity_summarization.csv"


@dataclass(frozen=True)
class VrsFiles:
    data: str = f"{Subpaths.vrs}/data.vrs"
    motion: str = f"{Subpaths.vrs}/motion.vrs"
    et: str = f"{Subpaths.vrs}/et.vrs"


@dataclass(frozen=True)
class SlamFiles:
    closed_loop_trajectory: str = f"{Subpaths.mps_slam}/closed_loop_trajectory.csv"
    online_calibration: str = f"{Subpaths.mps_slam}/online_calibration.jsonl"
    open_loop_trajectory: str = f"{Subpaths.mps_slam}/open_loop_trajectory.csv"
    semidense_points: str = f"{Subpaths.mps_slam}/semidense_points.csv.gz"
    semidense_observations: str = f"{Subpaths.mps_slam}/semidense_observations.csv.gz"
    location_summary: str = f"{Subpaths.mps_slam}/summary.json"


@dataclass(frozen=True)
class GazeFiles:
    general_gaze: str = f"{Subpaths.mps_gaze}/general_eye_gaze.csv"
    personalized_gaze: str = f"{Subpaths.mps_gaze}/personalized_eye_gaze.csv"


class DataGroups(Enum):
    """
    \brief Each variable defines one atomic downloadable element
    """

    LICENSE = Subpaths.license
    metadata_json = Subpaths.metadata_json

    body = Subpaths.body

    recording_head = Subpaths.recording_head
    recording_head_data_data_vrs = f"{Subpaths.recording_head}/{VrsFiles.data}"
    recording_lwrist = Subpaths.recording_lwrist
    recording_rwrist = Subpaths.recording_rwrist
    recording_observer = Subpaths.recording_observer
    recording_observer_data_data_vrs = f"{Subpaths.recording_observer}/{VrsFiles.data}"

    narration_motion_narration_csv = TextFiles.motion_narration
    narration_atomic_action_csv = TextFiles.atomic_action
    narration_activity_summarization_csv = TextFiles.activity_summarization

    semidense_observations = "semidense_observations"


def get_group_definitions() -> dict[str, list]:
    """
    \brief Definition of DataGroups
           File paths are relative with respect to each sequence folder.
           Some sequences might missing certain files/data groups
           due to errors occured from data collection or processing.
           There is one url per data group per sequence.
           Data groups with multiple files are packed into zip files.
    """
    AriaFiles = (
        [f.default for f in fields(VrsFiles) if "data" not in f.name]
        + [f.default for f in fields(SlamFiles) if "observations" not in f.name]
        + [f.default for f in fields(GazeFiles)]
    )
    miniAriaFiles = [f.default for f in fields(VrsFiles) if "et" not in f.name] + [
        f.default for f in fields(SlamFiles) if "observerations" not in f.name
    ]

    g_defs = {x.name: [x.value] for x in DataGroups}
    g_defs[DataGroups.body.name] = [x.default for x in fields(BodyFiles)]

    for x in [DataGroups.recording_head, DataGroups.recording_observer]:
        g_defs[x.name] = [f"{x.name}/{f}" for f in AriaFiles]

    for x in [DataGroups.recording_rwrist, DataGroups.recording_lwrist]:
        g_defs[x.name] = [f"{x.name}/{f}" for f in miniAriaFiles]

    g_defs[DataGroups.semidense_observations.name] = []
    for x in fields(Subpaths):
        if "recording" in x.name:
            g_defs[DataGroups.semidense_observations.name].append(
                f"{x.default}/{SlamFiles.semidense_observations}"
            )

    print("=== group definitions (group_name: [group_files]) ===")
    print(json.dumps(g_defs, indent=2))

    return g_defs


# get_group_definitions()