You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/dataloader.rst
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
PyTorch Integration
2
-
=============================
2
+
===================
3
3
4
4
Includes a PyTorch IterableDataset and IterableDataLoader for loading data from a remote SFTP server through the pyremotedata.RemotePathIterator class.
Creates a PyTorch dataset from a RemotePathIterator.
24
24
25
25
By default the dataset will return the image as a tensor and the remote path as a string.
26
-
27
-
### Hierarchical mode
28
-
If `hierarchical` >= 1, the dataset is in "Hierarchical mode" and will return the image as a tensor and the label as a list of integers (class indices for each level in the hierarchy).
29
-
30
-
The `class_handles` property can be used to get the class-idx mappings for the dataset.
31
-
32
-
By default the dataset will use a parser which assumes that the hierarchical levels are encoded in the remote path as directories like so:
33
26
34
-
`.../level_n/.../level_1/level_0/image.jpg`
35
-
36
-
Where `n = (hierarchical - 1)` and `level_0` is the leaf level.
27
+
"""""""""""""""""""""
28
+
**Hierarchical mode**
29
+
"""""""""""""""""""""
30
+
| If `hierarchical` >= 1, the dataset is in "Hierarchical mode" and will return the image as a tensor and the label as a list of integers (class indices for each level in the hierarchy).
31
+
| The `class_handles` property can be used to get the class-idx mappings for the dataset.
32
+
| By default the dataset will use a parser which assumes that the hierarchical levels are encoded in the remote path as directories like so:
33
+
| `.../level_n/.../level_1/level_0/image.jpg`
34
+
| Where `n = (hierarchical - 1)` and `level_0` is the leaf level.
37
35
38
36
Args:
39
37
remote_path_iterator (RemotePathIterator): The remote path iterator to create the dataset from.
@@ -47,7 +45,14 @@ class RemotePathDataset(IterableDataset):
47
45
return_remote_path (bool, optional): Whether to return the remote path. Default: False.
48
46
return_local_path (bool, optional): Whether to return the local path. Default: False.
49
47
verbose (bool, optional): Whether to print verbose output. Default: False.
50
-
"""
48
+
49
+
Yields:
50
+
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.
51
+
or
52
+
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.
53
+
or
54
+
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.
0 commit comments