MCPcopy
hub / github.com/pytorch/vision / __init__

Method __init__

torchvision/datasets/imagenet.py:52–65  ·  view source on GitHub ↗
(self, root: Union[str, Path], split: str = "train", **kwargs: Any)

Source from the content-addressed store, hash-verified

50 """
51
52 def __init__(self, root: Union[str, Path], split: str = "train", **kwargs: Any) -> None:
53 root = self.root = os.path.expanduser(root)
54 self.split = verify_str_arg(split, "split", ("train", "val"))
55
56 self.parse_archives()
57 wnid_to_classes = load_meta_file(self.root)[0]
58
59 super().__init__(self.split_folder, **kwargs)
60 self.root = root
61
62 self.wnids = self.classes
63 self.wnid_to_idx = self.class_to_idx
64 self.classes = [wnid_to_classes[wnid] for wnid in self.wnids]
65 self.class_to_idx = {cls: idx for idx, clss in enumerate(self.classes) for cls in clss}
66
67 def parse_archives(self) -> None:
68 if not check_integrity(os.path.join(self.root, META_FILE)):

Callers

nothing calls this directly

Calls 3

parse_archivesMethod · 0.95
verify_str_argFunction · 0.85
load_meta_fileFunction · 0.85

Tested by

no test coverage detected