nixingyang / AdaptiveL2Regularization

[ICPR 2020] Adaptive L2 Regularization in Person Re-Identification
https://ieeexplore.ieee.org/document/9412481
MIT License
64 stars 23 forks source link

Cosine Similarity in inference #17

Closed ash-holla28 closed 3 years ago

ash-holla28 commented 3 years ago

Hi there, I just wanted to know why you have made use of cosine distance similarity for inference procedure. I am confused with the use of triplet loss that you have used it for training the network and have you not made use of it during the inference. Where does cosine similarity play its role along with trained triplet loss re-identification network during inference? Hope you can clarify my doubts. Thank you

nixingyang commented 3 years ago

Hi, The triplet loss optimizes the features in the Euclidean space. Accordingly, one should calculate the Euclidean distance during inference. Nevertheless, opting for the cosine distance leads to performance improvements in practice. This inconsistency issue can be fixed by using A-Softmax. However, A-Softmax results in inferior performance based on my experiments. All the best. Xingyang Ni

ash-holla28 commented 3 years ago

Hi, Thank you, just have 2 clarifications, can you tell me what does inference_model.predict function in extract_features method returns? Since you have called it for both query and gallery images. Also in the rank_cy.pyx file line number 83 (if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid) as you are trying to perform cross camera re-identification, the first condition should it not be that the person id of the gallery be same as that of query? I agree with second condition of considering different camera ID with that of query camera ID. Please help with the confusion

nixingyang commented 3 years ago

Hi, Using inference_model.predict would extract features of the input images. You may check how inference_model is defined in init_model. The rank_cy.pyx script is adapted from deep-person-reid, and I haven't modified it. So you may post your questions there. All the best. Xingyang Ni

ash-holla28 commented 3 years ago

Thank you

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.