Ejemplo n.º 1
0
 def _check_integrity(self) -> bool:
     root = self.root
     for fentry in self.train_list + self.test_list:
         filename, md5 = fentry[0], fentry[1]
         fpath = os.path.join(root, self.base_folder, filename)
         if not _check_integrity(fpath, md5):
             return False
     return True
Ejemplo n.º 2
0
 def _load_meta(self) -> None:
     path = os.path.join(self.root, self.base_folder, self.meta["filename"])
     if not _check_integrity(path, self.meta["md5"]):
         raise RuntimeError(
             "Dataset metadata file not found or corrupted."
             + " You can use download=True to download it"
         )
     with open(path, "rb") as infile:
         data = pickle.load(infile, encoding="latin1")
         self.classes = data[self.meta["key"]]
     self.class_to_idx = {_class: i for i, _class in enumerate(self.classes)}