Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem for tripletloss #24

Open
amsturdy opened this issue Jun 23, 2020 · 4 comments
Open

problem for tripletloss #24

amsturdy opened this issue Jun 23, 2020 · 4 comments

Comments

@amsturdy
Copy link

amsturdy commented Jun 23, 2020

Is there some problem in forward of tripletloss?
Is it possible as listed as below?
cdd407d854fbc53fa81aa85bed90b84

@Podidiving
Copy link

Hi. I'm also have problems understanding this implementation of triplet loss
Can you explain the logic of L.reshape
dist has shape of [BatchSIze x BatchSIze], so what is the shape of ap_dist & an_dist after applying L.reshape(dist, (0, 0, 1)) L.reshape(dist, (1, 0, -1)) respectively? I'm confused with paddle and don't know what 0 and -1 mean in L.reshape

@yongqyu
Copy link

yongqyu commented Jun 24, 2020

Hello. I am not an author, but I think I can share this.
You can check it out here.
0 is the same shape as before, -1 is the new axis.
And ap and an calculate distance in every case, respectively, but as you can see in the code, they are transposed.
These two matrices are later combined for all combinations of the 3 vectors.
@amsturdy @Podidiving

@amsturdy amsturdy closed this as completed Jul 9, 2020
@amsturdy amsturdy reopened this Jul 9, 2020
@amsturdy amsturdy closed this as completed Jul 9, 2020
@amsturdy amsturdy reopened this Jul 9, 2020
@amsturdy
Copy link
Author

amsturdy commented Jul 9, 2020

The author computed "ap - an" distance firstly, but selected "pan" examples later. I think "apn" examples should be selected.

In the uploaded picture, "pa - an" distance computed firstly, and "pan" examples selected later.

@hitchhiker3010
Copy link

Hi @amsturdy
I felt there was an issue with the TripletLoss that was implemented on the original repo and made changes similar to yours but my anchor is on 1st dimension instead of the 2nd dimension that's in your change, would that make sense or do you see any challenges with that? I'm computing "ap - an" distance firstly and selecting "apn" examples later.
Would also like to understand if this change helped get better results?
Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants