MCPcopy Create free account
hub / github.com/apache/singa / load_dataset

Function load_dataset

examples/cnn/data/cifar10.py:30–40  ·  view source on GitHub ↗
(filepath)

Source from the content-addressed store, hash-verified

28
29
30def load_dataset(filepath):
31 with open(filepath, 'rb') as fd:
32 try:
33 cifar10 = pickle.load(fd, encoding='latin1')
34 except TypeError:
35 cifar10 = pickle.load(fd)
36 image = cifar10['data'].astype(dtype=np.uint8)
37 image = image.reshape((-1, 3, 32, 32))
38 label = np.asarray(cifar10['labels'], dtype=np.uint8)
39 label = label.reshape(label.size, 1)
40 return image, label
41
42
43def load_train_data(dir_path='/tmp/cifar-10-batches-py', num_batches=5): # need to save to specific local directories

Callers 2

load_train_dataFunction · 0.70
load_test_dataFunction · 0.70

Calls 2

loadMethod · 0.45
reshapeMethod · 0.45

Tested by

no test coverage detected