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

hard negative mining #6

Closed
lovejing0306 opened this issue Apr 22, 2020 · 2 comments
Closed

hard negative mining #6

lovejing0306 opened this issue Apr 22, 2020 · 2 comments

Comments

@lovejing0306
Copy link

lovejing0306 commented Apr 22, 2020

请问这里为什么要做两次sort?

loss_class_idx = tf.argsort(loss_class, axis=1, direction='DESCENDING')
loss_class_idx_rank = tf.argsort(loss_class_idx, axis=1)
@peteryuX
Copy link
Owner

因為這邊我要拿到每個element的rank,下面以numpy做解釋:

np.argsort([5,2,1,4])
array([2, 1, 3, 0], dtype=int64)

np.argsort(np.argsort([5,2,1,4]))
array([3, 1, 0, 2], dtype=int64) # <- rank of each element

@lovejing0306
Copy link
Author

明白了,多谢。

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