Hierarchical localization with panoramic views and triplet loss functions