Generalized Contrastive Optimization of Siamese Networks for Place Recognition