YujiaoShi / cross_view_localization_SAFA

48 stars 7 forks source link

Distance between features #6

Open Miaowshroom opened 2 years ago

Miaowshroom commented 2 years ago

Thank you for making the code available. After going through the loss function, I am a little confused about the loss and distance between features.

The features are normalized that shall have a modulus of 1. The distance between the two features is calculated as: dist_array = 2 - 2 * tf.matmul(sat_global, grd_global, transpose_b=True)

Which is more like cos similarity instead of L2 distance. The range of tf.matmul(sat_global, grd_global, transpose_b=True) is between [-1, 1] if the feature contains negative value. Hence, the dist_array has a range [0, 4]. What is the intention behind this specific scaling?

YujiaoShi commented 2 years ago

When the l2 norm of sat_global and grd_global is 1, this equation "dist_array = 2 - 2 * tf.matmul(sat_global, grd_global, transpose_b=True)" exactly corresponds to the l2 norm.

LV-BO001 commented 1 year ago

hello,please note the information of tensorflow' version and pytyhon' version,thank you.