You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
In the tripletselect layer, we aim to choose semi-hard negative examples. meaning, negative examples that are within a margin alpha comparing to the positive example.
In your custom layer, you sort both a_p and a_n examples so that the highest distance is first.
Don't we want the highest a_p distance and the smallest a_n distance so they might violate the semi-hard definition?
The following code with my suggested fix:
` archor_feature = bottom[0].data[0]
for i in range(self.triplet):
positive_feature = bottom[0].data[i+self.triplet]
a_p = archor_feature - positive_feature
ap = np.dot(a_p,a_p)
aps[i+self.triplet] = ap
aps = sorted(aps.items(), key = lambda d: d[1], reverse = True)
for i in range(self.triplet):
negative_feature = bottom[0].data[i+self.triplet*2]
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) # guyn - seems to me like a bug, we want the lowest distance to be first
ans = sorted(ans.items(), key = lambda d: d[1], reverse = False)`
What do you think?
Guy
The text was updated successfully, but these errors were encountered:
Hello,
In the tripletselect layer, we aim to choose semi-hard negative examples. meaning, negative examples that are within a margin alpha comparing to the positive example.
In your custom layer, you sort both a_p and a_n examples so that the highest distance is first.
Don't we want the highest a_p distance and the smallest a_n distance so they might violate the semi-hard definition?
The following code with my suggested fix:
` archor_feature = bottom[0].data[0]
What do you think?
Guy
The text was updated successfully, but these errors were encountered: