Hi Anna, I mentioned the two options for loss in the article. But in the code, I decided to explore a simple alternative way. We can find the dot product of 2 normalized vectors/embeddings. If they are from the same class, we can force the dot product to be 1 (similar) otherwise 0 (not similar). This will create orthogonal embeddings for each class.

In order to bring dot product closer to target output of 1 or 0, I have used MSE. I mentioned it in "Part 2: Create the model". Let me know if this answers your question.

You can check out my another article https://towardsdatascience.com/bird-song-classification-using-siamese-networks-and-dilated-convolutions-3b38a115bc1. It is based on Bird Song Classification using Siamese Networks. I have used triplet loss in this one.

--

--

--

Machine Learning PhD Student at University of Florida (he/him) https://adityadutt.github.io/

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aditya Dutt

Aditya Dutt

Machine Learning PhD Student at University of Florida (he/him) https://adityadutt.github.io/

More from Medium

The Tip Off: CBB Betting Card (Thursday Jan. 20th)

Tight oil & gas output in the US is on the rise.

IS GTE TECHNOLOGY IS LEGIT

A New Home for Papers Falling from an Attic Window