MCPcopy Create free account
hub / github.com/OUCMachineLearning/OUCML / load_mnist

Function load_mnist

GAN/Self_attention_GAN_tensorflow/utils.py:25–45  ·  view source on GitHub ↗
(size=64)

Source from the content-addressed store, hash-verified

23
24
25def load_mnist(size=64):
26 (train_data, train_labels), (test_data, test_labels) = mnist.load_data()
27 train_data = normalize(train_data)
28 test_data = normalize(test_data)
29 print(train_data.shape)
30 x = np.concatenate((train_data, test_data), axis=0)
31 print(x.shape)
32 # y = np.concatenate((train_labels, test_labels), axis=0).astype(np.int)
33
34 seed = 777
35 np.random.seed(seed)
36 np.random.shuffle(x)
37 # np.random.seed(seed)
38 # np.random.shuffle(y)
39 # x = np.expand_dims(x, axis=-1)
40 print(x.shape)
41
42 x = np.asarray([scipy.misc.imresize(x_img, [size, size]) for x_img in x])
43 x = np.expand_dims(x, axis=-1)
44 print(x.shape)
45 return x
46
47def load_cifar10(size=64) :
48 (train_data, train_labels), (test_data, test_labels) = cifar10.load_data()

Callers 2

__init__Method · 0.85
load_dataFunction · 0.85

Calls 2

normalizeFunction · 0.85
load_dataMethod · 0.45

Tested by

no test coverage detected