Commit 817bb882 authored by Yuxin Wu's avatar Yuxin Wu

update svhn performance

parent 2bc3a766
...@@ -20,7 +20,7 @@ from tensorpack.dataflow import imgaug ...@@ -20,7 +20,7 @@ from tensorpack.dataflow import imgaug
""" """
SVHN convnet. SVHN convnet.
About 3.0% validation error after 120 epoch. 2.7% after 300 epoch. About 3.0% validation error after 70 epoch. 2.5% after 130 epoch.
""" """
class Model(ModelDesc): class Model(ModelDesc):
...@@ -34,17 +34,16 @@ class Model(ModelDesc): ...@@ -34,17 +34,16 @@ class Model(ModelDesc):
image = image / 128.0 - 1 image = image / 128.0 - 1
nl = lambda x, name: tf.abs(tf.tanh(x), name=name) l = Conv2D('conv1', image, 24, 5, padding='VALID')
l = Conv2D('conv1', image, 24, 5, padding='VALID', nl=nl)
l = MaxPooling('pool1', l, 2, padding='SAME') l = MaxPooling('pool1', l, 2, padding='SAME')
l = Conv2D('conv2', l, 32, 3, nl=nl, padding='VALID') l = Conv2D('conv2', l, 32, 3, padding='VALID')
l = Conv2D('conv3', l, 32, 3, nl=nl, padding='VALID') l = Conv2D('conv3', l, 32, 3, padding='VALID')
l = MaxPooling('pool2', l, 2, padding='SAME') l = MaxPooling('pool2', l, 2, padding='SAME')
l = Conv2D('conv4', l, 64, 3, nl=nl, padding='VALID') l = Conv2D('conv4', l, 64, 3, padding='VALID')
l = tf.nn.dropout(l, keep_prob) l = tf.nn.dropout(l, keep_prob)
l = FullyConnected('fc0', l, 512, l = FullyConnected('fc0', l, 512,
b_init=tf.constant_initializer(0.1), nl=nl) b_init=tf.constant_initializer(0.1))
# fc will have activation summary by default. disable for the output layer # fc will have activation summary by default. disable for the output layer
logits = FullyConnected('linear', l, out_dim=10, summary_activation=False, logits = FullyConnected('linear', l, out_dim=10, summary_activation=False,
nl=tf.identity) nl=tf.identity)
......
...@@ -49,7 +49,6 @@ http://ufldl.stanford.edu/housenumbers/".format(filename) ...@@ -49,7 +49,6 @@ http://ufldl.stanford.edu/housenumbers/".format(filename)
self.Y[self.Y==10] = 0 self.Y[self.Y==10] = 0
SVHNDigit.Cache[name] = (self.X, self.Y) SVHNDigit.Cache[name] = (self.X, self.Y)
def size(self): def size(self):
return self.X.shape[0] return self.X.shape[0]
......
...@@ -73,4 +73,4 @@ class ModelDesc(object): ...@@ -73,4 +73,4 @@ class ModelDesc(object):
def get_gradient_processor(self): def get_gradient_processor(self):
""" Return a list of GradientProcessor. They will be executed in order""" """ Return a list of GradientProcessor. They will be executed in order"""
return [CheckGradient(), SummaryGradient()] return [CheckGradient()]#, SummaryGradient()]
...@@ -64,6 +64,7 @@ class Trainer(object): ...@@ -64,6 +64,7 @@ class Trainer(object):
def main_loop(self): def main_loop(self):
# some final operations that might modify the graph # some final operations that might modify the graph
logger.info("Preparing for training...")
self._init_summary() self._init_summary()
get_global_step_var() get_global_step_var()
callbacks = self.config.callbacks callbacks = self.config.callbacks
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment