spdl.source.imagenet.ImageNet¶
- class ImageNet(root: str | PathLike[str], split: str = 'val')[source]¶
Bases:
IterableWithShuffle
[tuple
[Path
,int
]]Traverse the local file directory contains ImageNet dataset.
- Parameters:
root – The root directory where
"val"
and"train"
subdirectory is found.split – Dataset split. The valid choices are
"val"
or"train"
.
Methods
shuffle
(seed)Apply in-place shuffling
- __iter__() Iterator[tuple[Path, int]] [source]¶
- Yields:
Path and class – Path to an image file and the class ID of the image.
See also
parse_wnid()
,get_mappings()
: Functions used to retrieve class ID from path.