Datasets:

ArXiv:
License:
File size: 2,401 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
# 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 sys
from pathlib import Path

import click
from loguru import logger
from nymeria.definitions import DataGroups
from nymeria.download_utils import DownloadManager


def get_groups(full: bool = False) -> list[DataGroups]:
    """
    By default all data present in nymeria_download_urls.json will be downloaded.
    For selective download, comment out lines to disable certain groups.
    See nymeria/definitions.py GroupDefs for the files included by each group.
    """
    return [
        DataGroups.LICENSE,
        DataGroups.metadata_json,
        DataGroups.body,
        DataGroups.recording_head,
        DataGroups.recording_head_data_data_vrs,
        DataGroups.recording_lwrist,
        DataGroups.recording_rwrist,
        DataGroups.recording_observer,
        DataGroups.recording_observer_data_data_vrs,
        DataGroups.narration_motion_narration_csv,
        DataGroups.narration_atomic_action_csv,
        DataGroups.narration_activity_summarization_csv,
        DataGroups.semidense_observations,
    ]


@click.command()
@click.option(
    "-i",
    "url_json",
    type=click.Path(file_okay=True, dir_okay=False, path_type=Path),
    default=None,
    required=True,
    help="The json file contains download urls. Follow README.md instructions to access this file.",
)
@click.option(
    "-o",
    "rootdir",
    type=click.Path(file_okay=False, dir_okay=True, writable=True, path_type=Path),
    default=None,
    help="The root directory to hold the downloaded dataset",
)
@click.option(
    "-k",
    "match_key",
    default="2023",
    help="Partial key used to filter sequences for downloading"
    "Default key value = 2023, which include all available sequences",
)
def main(url_json: Path, rootdir: Path, match_key: str = "2023") -> None:
    logger.remove()
    logger.add(
        sys.stdout,
        colorize=True,
        format="<level>{level: <7}</level> <blue>{name}.py:</blue><green>{function}</green><yellow>:{line}</yellow> {message}",
        level="INFO",
    )

    dl = DownloadManager(url_json, out_rootdir=rootdir)
    dl.download(match_key=match_key, selected_groups=get_groups(), ignore_existing=True)


if __name__ == "__main__":
    main()