Skip to content

Commit

Permalink
adding results
Browse files Browse the repository at this point in the history
  • Loading branch information
shekkizh committed Sep 22, 2016
1 parent efc2ded commit 9f56870
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions EBGAN/Faces_EBGAN.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,17 @@ def discriminator(input_images, train_mode):


def pullaway_loss(embeddings):
"""
Pull Away loss calculation
:param embeddings: The embeddings to be orthogonalized for varied faces. Shape [batch_size, embeddings_dim]
:return: pull away term loss
"""
norm = tf.sqrt(tf.reduce_sum(tf.square(embeddings), 1, keep_dims=True))
normalized_embeddings = embeddings / norm
similarity = tf.matmul(
normalized_embeddings, normalized_embeddings, transpose_b=True)
batch_size = tf.cast(tf.shape(embeddings)[0], tf.float32)
pt_loss = (tf.reduce_sum(similarity) - batch_size) / (batch_size * (batch_size-1))
pt_loss = (tf.reduce_sum(similarity) - batch_size) / (batch_size * (batch_size - 1))
return pt_loss


Expand Down Expand Up @@ -250,6 +255,7 @@ def main(argv=None):
pt_loss = 0
if FLAGS.pt:
print("Adding pull away loss term...")
# Using all the embeddings for pull away loss - no mini batches
pt_loss = pullaway_loss(embeddings_fake)
gen_loss = discrimintator_loss_fake + PT_LOSS_WEIGHT * pt_loss

Expand Down Expand Up @@ -307,7 +313,7 @@ def visualize():
sess.run(discriminator_train_op, feed_dict=feed_dict)
sess.run(generator_train_op, feed_dict=feed_dict)
sess.run(generator_train_op, feed_dict=feed_dict)

if itr % 10 == 0:
g_loss_val, d_loss_val, summary_str = sess.run([gen_loss, discriminator_loss, summary_op],
feed_dict=feed_dict)
Expand Down
Binary file added logs/images/decoded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logs/images/failed_fake1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logs/images/failed_fake2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logs/images/failed_real1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logs/images/failed_real2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logs/images/margin20_fake.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logs/images/margin20_real.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logs/images/pullaway_fake.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logs/images/pullaway_real.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9f56870

Please sign in to comment.