Siamese Net BackProp,如何有效更新?

时间:2016-12-20 11:19:31

标签: tensorflow backpropagation

如果在Tensorflow中给出对比度损失函数,如何最有效地更新连体网的共享权重?

1 个答案:

答案 0 :(得分:1)

摘要生成嵌入函数的网络。只需调用该函数两次 - 每次传入的图像一次。它被称为两个网络......这对我来说似乎是夸大其词。只是你通过同一个网络传递它。您需要在两个函数调用之间reuse variables。我的代码看起来像这样:

def pipeline(images, reuse):
  with tf.variable_scope('pipeline', reuse=reuse) as scope:
  # ... conv layers etc. That produce the embedding.

output_a = pipeline(a_images, False)
output_b = pipeline(b_images, True)