Siamese Net BackProp,如何有效更新?

Siamese Net BackProp, how to effectively update?

给定 Tensorflow 中的对比损失函数,如何最有效地更新 Siamese Net 的共享权重?

将生成嵌入的网络抽象为一个函数。只需调用该函数两次 - 每传入一张图像一次。它被称为两个网络......这对我来说似乎是夸大其词。只是你通过同一个网络传递它。您需要 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)