Skip to content

Commit

Permalink
cifar preprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
anantzoid committed Nov 30, 2016
1 parent 3c5e972 commit 39e2f5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def train(conf, data):
from keras.datasets import cifar10
data = cifar10.load_data()
labels = data[0][1]
data = data[0][0] / 255.0
data = data[0][0].astype(np.float32)
data[:,0,:,:] -= np.mean(data[:,0,:,:])
data[:,1,:,:] -= np.mean(data[:,1,:,:])
data[:,2,:,:] -= np.mean(data[:,2,:,:])
data = np.transpose(data, (0, 2, 3, 1))
conf.img_height = 32
conf.img_width = 32
Expand Down
4 changes: 2 additions & 2 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def __init__(self, X, conf, h=None):
the 2 methods which may be used, with the first one (self.pred)
being more likely.
'''
self.pred = tf.reshape(tf.multinomial(tf.nn.softmax(self.fc2), num_samples=1, seed=100), tf.shape(self.X))
self.pred_argmax = tf.reshape(tf.argmax(tf.nn.softmax(self.fc2), dimension=tf.rank(self.fc2) - 1), tf.shape(self.X))
self.pred_sampling = tf.reshape(tf.multinomial(tf.nn.softmax(self.fc2), num_samples=1, seed=100), tf.shape(self.X))
self.pred = tf.reshape(tf.argmax(tf.nn.softmax(self.fc2), dimension=tf.rank(self.fc2) - 1), tf.shape(self.X))


class ConvolutionalEncoder(object):
Expand Down

0 comments on commit 39e2f5f

Please sign in to comment.