Commit e155ed50 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

improve logging in losses

parent 036a308f
......@@ -4,8 +4,8 @@
import logging
import tensorflow as tf
logger = logging.getLogger("bob.learn.tensorflow")
import functools
logger = logging.getLogger("bob.learn.tensorflow")
def content_loss(noises, content_features):
......
......@@ -57,24 +57,19 @@ def triplet_loss(anchor_embedding,
with tf.name_scope("TripletLoss"):
# Between
between_class_loss = tf.reduce_mean(d_negative)
tf.summary.scalar('between_class', between_class_loss)
tf.summary.scalar('loss_between_class', between_class_loss)
tf.add_to_collection(tf.GraphKeys.LOSSES, between_class_loss)
# Within
within_class_loss = tf.reduce_mean(d_positive)
tf.summary.scalar('within_class', within_class_loss)
tf.summary.scalar('loss_within_class', within_class_loss)
tf.add_to_collection(tf.GraphKeys.LOSSES, within_class_loss)
# Total loss
loss = tf.reduce_mean(
tf.maximum(basic_loss, 0.0), 0, name="total_loss")
tf.add_to_collection(tf.GraphKeys.LOSSES, loss)
tf.summary.scalar('loss_raw', loss)
# Appending the regularization loss
#regularization_losses = tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)
#loss = tf.add_n([loss] + regularization_losses, name="total_loss")
#tf.summary.scalar('loss', loss)
tf.summary.scalar('loss_triplet', loss)
return loss
......
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