Siamese Model Finds Middle Distance

I’m using triplet loss and I have 2 classes. Similarity measure is cosine. It seems that my siamese model found a method for local minima which is giving same vectors for every image. With that, both anchor-positive and anchor-negative distances give 0. Moreover, sometimes model finds a way to give 0 for every vector too.

How can I prevent such things? Thank you.

Hi @Tarkan_Atak_Kan ,

Thank you for your post and Welcome to our community! It seems this is your first case here :slight_smile:

@Tarkan_Atak_Kan , could you please tell us what course / week / assignment are you asking about? it looks like you entered your case in the General Discussion, and I’d like to help you re-classify it so an expert can assist you.

Thank you!


Hi @Juan_Olano ,

Thanks for your kind welcome. I’m not taking a course or trying to solve an assignment. It’s about my project. I thought I might get help from here.