Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix standardization of input #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions semisup/architectures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)):
Expand Down Expand Up @@ -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:
Expand Down