I am trying to understand Siamese networks, and understand how to train them.

Once I have a trained network, I want to know if a new image is close or far to other images in the train set, and fail to understand how to do that.

Here this question was more or less asked before.

The gist of the answer is:

compare cosine similarity of vec_base and vec_test in order to determine whether base and test are within the acceptable criteria.

Here, it is suggested to do Nearest Neighbor search.

What I still don't understand is

  1. How to get the image(s) to test against? Do I need to find good representatives for each class? What is "good"?
  2. Why cosine similarity of all metrics?
  3. Doing nearest neighbor over the entire dataset makes no sense, performance-wise - let alone at test time, even with a k-d-tree. Have I missed something fundamental?


Browse other questions tagged or ask your own question.