Skip to content

Commit 115e04e

Browse files
committed
Another slight doc update, and minor code modification to make type hint correct.
1 parent 3647d3f commit 115e04e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/pyremotedata/dataloader.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ class RemotePathDataset(IterableDataset):
5050
verbose (bool, optional): Whether to print verbose output. Default: False.
5151
5252
Yields:
53-
Tuple[torch.Tensor, Union[str, List[int]]]: A tuple containing the image as a tensor and the label as the remote path or class indices.
54-
or
55-
Tuple[torch.Tensor, Union[str, List[int]], str]: A tuple containing the image as a tensor, the label as the remote path or class indices, and the local or remote path.
56-
or
57-
Tuple[torch.Tensor, Union[str, List[int]], str, str]: A tuple containing the image as a tensor, the label as the remote path or class indices, the local path, and the remote path.
53+
tuple: A tuple containing the following elements:
54+
- torch.Tensor: The image as a tensor.
55+
- Union[str, List[int]]: The label as the remote path or as a list of class indices.
56+
- Optional[str]: The local path, if `return_local_path` is True.
57+
- Optional[str]: The remote path, if `return_remote_path` is True.
5858
'''
5959
def __init__(
6060
self,
@@ -378,13 +378,10 @@ def parse_item(self, local_path : str, remote_path : str) -> Union[Tuple[torch.T
378378
## Label processing
379379
# Get the label by parsing the remote path
380380
hierarchy = self.parse_hierarchy(remote_path)
381-
# TODO: Use the family and genus information (or add a "species only" flag)
382381
# Transform the species name to the label index
383382
label = [self.class_to_idx[level][cls] for level, cls in enumerate(hierarchy)]
384383
if len(label) == 0:
385384
raise ValueError(f"Error parsing label from {remote_path}.")
386-
elif len(label) == 1:
387-
label = label[0]
388385
else:
389386
label = remote_path
390387

0 commit comments

Comments
 (0)