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

Method load_labels

python/graphvite/dataset.py:824–837  ·  view source on GitHub ↗
(self, meta_file, *batch_files)

Source from the content-addressed store, hash-verified

822 return np.concatenate(images)
823
824 def load_labels(self, meta_file, *batch_files):
825 classes = []
826 with open(meta_file, "r") as fin:
827 for line in fin:
828 line = line.strip()
829 if line:
830 classes.append(line)
831 classes = np.asarray(classes)
832 labels = []
833 for batch_file in batch_files:
834 batch = np.fromfile(batch_file, dtype=np.uint8)
835 batch = batch.reshape(-1, 32*32*3 + 1)
836 labels.append(batch[:, 0])
837 return classes[np.concatenate(labels)]
838
839 def train_image_data_preprocess(self, raw_path, save_file):
840 batch_files = glob.glob(os.path.join(raw_path, "cifar-10-batches-bin/data_batch_*.bin"))

Callers 2

Calls

no outgoing calls

Tested by 1