diff options
Diffstat (limited to 'cgan.py')
-rwxr-xr-x | cgan.py | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -194,21 +194,23 @@ class CGAN(): fig.savefig("images/%d.png" % epoch) plt.close() - def generate_data(self, split): - train_size = int((55000*100/split)-55000) - val_size = int(train_size/11) + def generate_data(self, output_train = 55000): + # with this output_train you specify how much training data you want. the other two variables produce validation + # and testing data in proportions equal to the ones of MNIST dataset + + val_size = int(output_train/11) test_size = 2*val_size - noise_train = np.random.normal(0, 1, (train_size, 100)) + noise_train = np.random.normal(0, 1, (output_train, 100)) noise_test = np.random.normal(0, 1, (test_size, 100)) noise_val = np.random.normal(0, 1, (val_size, 100)) - labels_train = np.zeros(train_size).reshape(-1, 1) + labels_train = np.zeros(output_train).reshape(-1, 1) labels_test = np.zeros(test_size).reshape(-1, 1) labels_val = np.zeros(val_size).reshape(-1, 1) for i in range(10): - labels_train[i*int(train_size/10):-1] = i + labels_train[i*int(output_train/10):-1] = i labels_test[i*int(test_size/10):-1] = i labels_val[i*int(val_size/10):-1] = i |