EBGAN.tensorflow icon indicating copy to clipboard operation
EBGAN.tensorflow copied to clipboard

pullaway_loss compute wrong

Open YanWenqiang opened this issue 5 years ago • 0 comments

https://github.com/shekkizh/EBGAN.tensorflow/blob/7c12383ac9444e5f15d6bc51ceed6bc77bea04fa/EBGAN/Faces_EBGAN.py#L209 In the paper, after computing the similarity, there exists element-wise square. Maybe below will be right.

embeddings_norm = tf.nn.l2_normalize(embeddings, axis = 1)
up = tf.reduce_sum(tf.square(tf.matmul(embeddings_norm, embeddings_norm, transpose_b = True)))
batch = tf.cast(tf.shape(embeddings)[0], dtype = tf.float32)
f = (up - batch) / (batch * (batch - 1))
with tf.Session() as sess:
    print(sess.run(f))
    print(sess.run(s_norm))

YanWenqiang avatar Jun 19 '19 03:06 YanWenqiang