From a39781a8882f8d353f0809c00743b84ed8690149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E4=B8=B0=E5=93=B2?= Date: Sun, 27 Aug 2017 20:47:49 +0800 Subject: [PATCH] fix standardization of input --- semisup/architectures.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/semisup/architectures.py b/semisup/architectures.py index 425295b..2ded5f4 100644 --- a/semisup/architectures.py +++ b/semisup/architectures.py @@ -55,7 +55,7 @@ def svhn_model(inputs, net = inputs mean = tf.reduce_mean(net, [1, 2], True) std = tf.reduce_mean(tf.square(net - mean), [1, 2], True) - net = (net - mean) / (std + 1e-5) + net = (net - mean) / tf.sqrt(std + 1e-5) with slim.arg_scope( [slim.conv2d, slim.fully_connected], activation_fn=tf.nn.elu, @@ -108,7 +108,7 @@ def dann_model(inputs, net = inputs mean = tf.reduce_mean(net, [1, 2], True) std = tf.reduce_mean(tf.square(net - mean), [1, 2], True) - net = (net - mean) / (std + 1e-5) + net = (net - mean) / tf.sqrt(std + 1e-5) with slim.arg_scope( [slim.conv2d, slim.fully_connected], activation_fn=tf.nn.relu, @@ -266,7 +266,7 @@ def inception_model(inputs, net = inputs mean = tf.reduce_mean(net, [1, 2], True) std = tf.reduce_mean(tf.square(net - mean), [1, 2], True) - net = (net - mean) / (std + 1e-5) + net = (net - mean) / tf.sqrt(std + 1e-5) inputs = net @@ -315,7 +315,7 @@ def vgg16_model(inputs, emb_size=128, is_training=True, img_shape=None, new_shap net = inputs mean = tf.reduce_mean(net, [1, 2], True) std = tf.reduce_mean(tf.square(net - mean), [1, 2], True) - net = (net - mean) / (std + 1e-5) + net = (net - mean) / tf.sqrt(std + 1e-5) with slim.arg_scope( [slim.conv2d, slim.fully_connected], weights_regularizer=slim.l2_regularizer(l2_weight)): @@ -403,7 +403,7 @@ def alexnet_v2(inputs, net = inputs mean = tf.reduce_mean(net, [1, 2], True) std = tf.reduce_mean(tf.square(net - mean), [1, 2], True) - net = (net - mean) / (std + 1e-5) + net = (net - mean) / tf.sqrt(std + 1e-5) inputs = net with variable_scope.variable_scope(scope, 'alexnet_v2', [inputs]) as sc: