I am building a Siamese Neural Network for Images (CNN) which uses the FaceNet's Triplet Loss as its loss function. I found a good Implementation here where we build a model and the outputs from the CNN are l-2 Normalised as this will normalize the output vector and map it to the surface of n-dimensional hyper-sphere of radius 1. This is done to make sure that the value of similarity between images can be compared by calculating distance between two embeddings, as all the embedding will reside on the surface that will give a better result. This is described very effectively in this awesome stack answer

It can be done my a single line of code in Tensorflow as x = Lambda(lambda x: K.l2_normalize(x,axis=-1))(x)

As given in this paper Authors did not use Normalisation and had to suffer from choosing a margin parameter alpha. So is done in this Keras Official tutorial about CNN Siamese using Triplet Loss. They haven't even used a Normalisation either. I want to know what are pros and Cons of using and not using the Normalisation?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.