Closed cattaneod closed 6 years ago
Hi,
Thank you for your interest in our work. The definition of triplet loss is shown below:
where a, p, n are the anchor and corresponding positive and negative, respectively. Simply following this definition, there is no need for the usage of "reduce_min" or "reduce_max". Either case, it is still the triplet loss
As stated under Implementation Details in our supplementary material, we just found that if we took the best/closest among two randomly sampled positives for each tuple, we found the training to be more stable which is why we used "reduced_min", ie taking the closest positive. The original NetVLAD paper also takes the best positive in each training tuple for their loss function because of their weakly supervised approach. Using "reduce_max" is also possible, both are correct, the interpretation of using "reduce_max" is taking the HARDEST positive in the training tuple instead of the best. So this can potentially be used to further improve the model because it will result in a higher loss value. If you are able to improve the results by further training with "reduce_max" then that's great!
The implementation of using "reduce_max" is also in the code I uploaded, it was just commented out because I found some stability issue initially.
Regards, Mika
Thanks for your answer, I observed that with reduce_min, the loss in later epochs is often zero (around half of the time). Just for personal curiosity, i will try to train again my implementation with the closest positive match (i only trained it with the hardest positive).
Yes, reduce_min will eventually give a loss of 0 in the later epochs. I suspect reduce_max eventually will also be the same. I think that the performance can also possibly improve if you further train with reduce_max.
Actually, currently the best model we have achieved is also 84% for top 1% (baseline). We will upload this model soon.
@catta202000 Hi, I also wan to port the tensorflow based code to pytorch. I was wondering how you implement VLAD. In my code, I define a conv layer and parameters for cluster features(size[Num_clusters, Dim_features]).And the cluster features are initialized from random. When I train the whole net, the loss behaves strangely: decreases to zero rapidly. Could you please share your implementation of VLAD with me?? Thank you very much.
@SJTUsuperxu Hi, my implementation is based on LOUPE tensorflow toolbox, you can find my PyTorch implementation here: Link
I think i will release my whole PointNetVlad Pytorch implementation soon.
@catta202000 @mikacuy Thanks a lot
@catta202000 Now I can get access to this link.. I will look into it in details. Thanks.
Thanks a lot
I think your implementation of best_pos_distance (which is used for every loss in your code) should use reduce_max instead of reduce_min (following the original hard triplet loss paper). I re-implemented your code in PyTorch, and with max pos_distance i got an average top 1% recall on oxford baseline (no refine) of 84%