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

Negative mining in TripletSelectLayer #57

Open
PramuPerera opened this issue Dec 22, 2017 · 1 comment
Open

Negative mining in TripletSelectLayer #57

PramuPerera opened this issue Dec 22, 2017 · 1 comment

Comments

@PramuPerera
Copy link

Hello,

When selecting the negative triplet, right now, you are picking the sample furthest away from the anchor.

for i in range(self.triplet):
negative_feature = bottom[0].data[i+self.triplet2]
a_n = archor_feature - negative_feature
an = np.dot(a_n,a_n)
ans[i+self.triplet
2] = an
ans = sorted(ans.items(), key = lambda d: d[1], reverse = True)

top_negative.append(bottom[0].data[ans[i][0]])

If we are mining the hardest negative sample, shouldn,'t we consider the closest negative sample to the anchor? Correct me if I'm wrong. Thanks!

@luhaofang
Copy link
Owner

Hi, you are not wrong, the select method is used to smooth the gradient, much depends on your dataset.

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

2 participants