I am curious about the working of a Siamese network. So, let us suppose I am using a triplet loss for my network and I have instantiated single CNN 3 times and there are 3 inputs to the network. So, during a forward pass, each of the networks will give me an embedding for each image, and I can get the distance and calculate the loss and compare it with the output, so that my model is ready to propagate the gradients to update the weights.

The Question: How do these weights get updated during the back propagation? Just because we are using 3 inputs and 3 branches of the same network and we are passing the inputs one by one (I suppose), how do the gradients are updated? Are these series? Like the one branch will update, then the second and then the third. But won't it be a problem because each branch would try to update based on its output? If in parallel, then which branch is responsible for the gradients update? I mean to say that I am unable to get the idea how weights are updated in Siamese network. Can someone please explain in simpler terms?

  • $\begingroup$ It may be worth providing a link to both the siamese network paper, the paper that describes what you call "triple loss" (I suppose the Siamese paper), which I am not aware of, and what you mean by "single CNN 3 times". I suppose that whoever is familiar with the details of the Siamese network will understand your question, but it may still be useful to provide more context (and the links). $\endgroup$
    – nbro
    Jan 6, 2021 at 12:15


You must log in to answer this question.