zs-zhong / DJSRH

The code for Deep Joint-Semantics Reconstructing Hashing for Large-Scale Unsupervised Cross-Modal Retrieval (ICCV 2019)
MIT License
73 stars 17 forks source link

S_I=S_I*2 -1 #5

Closed xinfangliu closed 4 years ago

xinfangliu commented 4 years ago

why need this operation 'S_I=S_I*2 -1' after calculating the cos similarity matrix?

zs-zhong commented 4 years ago

Hi, due to F_I = ImgNet.alexnet.features(x), F_I >= 0 (After ReLU). The original S_I = F_I.mm(F_I.t()) is in [0, 1]. To limit it in [-1, 1], we apply S_I = S_I * 2 - 1 here.

xinfangliu commented 4 years ago

Hi, due to F_I = ImgNet.alexnet.features(x), F_I >= 0 (After ReLU). The original S_I = F_I.mm(F_I.t()) is in [0, 1]. To limit it in [-1, 1], we apply S_I = S_I * 2 - 1 here.

I see. Thank you for your answer