|
10 | 10 | import tensorflow_datasets as tfds |
11 | 11 |
|
12 | 12 | from os import path |
13 | | -from typing import Dict, Any, Set, Optional |
| 13 | +from typing import Dict, Any, Set, Optional, List |
14 | 14 | from pose_format.utils.openpose import load_openpose, OpenPoseFrames |
15 | 15 | from pose_format.pose import Pose |
16 | 16 |
|
@@ -102,24 +102,28 @@ def get_openpose(openpose_path: str, fps: int, people: Optional[Set] = None, |
102 | 102 | return poses |
103 | 103 |
|
104 | 104 |
|
105 | | -def load_split(split_name: str) -> Dict[str, str]: |
| 105 | +def load_split(split_name: str) -> Dict[str, List[str]]: |
106 | 106 | """ |
| 107 | + Loads a split from the file system. What is loaded must be a JSON object with the following structure: |
107 | 108 |
|
108 | | - :param split_name: |
109 | | - :return: |
| 109 | + {"train": ..., "dev": ..., "test": ...} |
| 110 | +
|
| 111 | + :param split_name: An identifier for a predefined split or a filepath to a custom split file. |
| 112 | + :return: The split loaded as a dictionary. |
110 | 113 | """ |
111 | 114 | if split_name not in _KNOWN_SPLITS.keys(): |
| 115 | + # assume that the supplied string is a path on the file system |
112 | 116 | if not path.exists(split_name): |
113 | | - raise ValueError("Split '%s' is not a known data split identifier and does not exist as a file either." % split_name) |
| 117 | + raise ValueError("Split '%s' is not a known data split identifier and does not exist as a file either.\n" |
| 118 | + "Known split identifiers are: %s" % (split_name, str(_KNOWN_SPLITS))) |
114 | 119 |
|
115 | | - # assume that the supplied string is a path on the file system |
116 | 120 | split_path = split_name |
117 | 121 | else: |
118 | 122 | # the supplied string is an identifier for a predefined split |
119 | 123 | split_path = _KNOWN_SPLITS[split_name] |
120 | 124 |
|
121 | 125 | with open(split_path) as infile: |
122 | | - split = json.load(infile) # type: Dict[str, str] |
| 126 | + split = json.load(infile) # type: Dict[str, List[str]] |
123 | 127 |
|
124 | 128 | return split |
125 | 129 |
|
|
0 commit comments