aboutsummaryrefslogtreecommitdiff
path: root/ncdcgan.py
diff options
context:
space:
mode:
Diffstat (limited to 'ncdcgan.py')
-rwxr-xr-xncdcgan.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/ncdcgan.py b/ncdcgan.py
index ccb99d3..ce6b907 100755
--- a/ncdcgan.py
+++ b/ncdcgan.py
@@ -157,6 +157,7 @@ class nCDCGAN():
X_train = (X_train.astype(np.float32) - 127.5) / 127.5
X_train = np.expand_dims(X_train, axis=3)
y_train = y_train.reshape(-1, 1)
+ y_train = (y_train.astype(np.float32)-4.5)/4.5
# Adversarial ground truths
valid = np.ones((batch_size, 1))
@@ -214,6 +215,7 @@ class nCDCGAN():
r, c = 2, 5
noise = np.random.normal(0, 1, (r * c, 100))
sampled_labels = np.arange(0, 10).reshape(-1, 1)
+ sampled_labels = (sampled_labels.astype(np.float32)-4.5)/4.5
#using dummy_labels would just print zeros to help identify image quality
#dummy_labels = np.zeros(32).reshape(-1, 1)
@@ -239,6 +241,7 @@ class nCDCGAN():
noise_test = np.random.normal(0, 1, (10000, 100))
noise_val = np.random.normal(0, 1, (5000, 100))
+ ((labels_val.astype(np.float32)-4.5)/4.5)
labels_train = np.zeros(55000).reshape(-1, 1)
labels_test = np.zeros(10000).reshape(-1, 1)
labels_val = np.zeros(5000).reshape(-1, 1)
@@ -248,9 +251,9 @@ class nCDCGAN():
labels_test[i*1000:-1] = i
labels_val[i*500:-1] = i
- train_data = self.generator.predict([noise_train, labels_train])
- test_data = self.generator.predict([noise_test, labels_test])
- val_data = self.generator.predict([noise_val, labels_val])
+ train_data = self.generator.predict([noise_train, ((labels_train.astype(np.float32)-4.5)/4.5)])
+ test_data = self.generator.predict([noise_test, ((labels_test.astype(np.float32)-4.5)/4.5)])
+ val_data = self.generator.predict([noise_val,((labels_val.astype(np.float32)-4.5)/4.5)])
labels_train = keras.utils.to_categorical(labels_train, 10)
labels_test = keras.utils.to_categorical(labels_test, 10)