MCPcopy Create free account
hub / github.com/DeepGraphLearning/graphvite / valid_label_preprocess

Method valid_label_preprocess

python/graphvite/dataset.py:1025–1037  ·  view source on GitHub ↗
(self, meta_path, save_file)

Source from the content-addressed store, hash-verified

1023 return features
1024
1025 def valid_label_preprocess(self, meta_path, save_file):
1026 from scipy.io import loadmat
1027
1028 meta_file = os.path.join(meta_path, "ILSVRC2012_devkit_t12/data/meta.mat")
1029 id_file = os.path.join(meta_path, "ILSVRC2012_devkit_t12/data/ILSVRC2012_validation_ground_truth.txt")
1030
1031 metas = loadmat(meta_file, squeeze_me=True)["synsets"][:1000]
1032 id2class = {meta[0]: meta[1] for meta in metas}
1033 ids = np.loadtxt(id_file, dtype=np.int32)
1034 labels = [id2class[id] for id in ids]
1035 # be consistent with the order in torch.utils.data.DataLoader
1036 labels = sorted(labels)
1037 self.readable_label(labels, save_file)
1038
1039 def valid_hierarchical_label_preprocess(self, meta_path, save_file):
1040 from scipy.io import loadmat

Callers

nothing calls this directly

Calls 1

readable_labelMethod · 0.95

Tested by

no test coverage detected