-
Notifications
You must be signed in to change notification settings - Fork 125
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
A Question about the Calculation of cauchy_cross_entroy Loss #28
Comments
Hi, I think that calculating the loss within the batch and cross two batches are both ok. |
I found this problem when I tried to modify the DCH based on the HashNet code, because I was more familiar with pytorch. I modified the loss function of HashNet according to the DCH paper and tensorflow code, but if I used the image data from two batches to calculate loss, the result would be |
I can't understand why it's set to come from the same batch. |
Hi, a batch also contains some samples. So i and j can be any number in [0, batch_size) and we can calculate the cross entropy loss for all pair (i, j) within the batch. |
PYI: In our implementation, ip_1 and label_ip both have shape [bs, bs] where bs is the batch size. |
Hi, I think the But I understand that h_i or h_j is a row of |
Why ip[i][i] is not meaningful? They come from different i and j. |
ip[i][j] is meaningful, they come from different i and j, but ip[i][i] is dist(h_i, h_i) not dist(h_i, h_j), it represents a hash code of an image dot product by itself |
Ok, I understand your question now. |
Thank you for your answer. Through the discussion with you, I am more convinced that my understanding is correct or not. |
Ok. Welcome to discuss with me. |
Hello, I recently looked at the DCH method in the DeepHash library, but I encountered some incomprehension, as shown in the following figure
The parameter
v
andlabel_v
in functioncauchy_cross_entroy
is alwaysNone
, so in functioncauchy_cross_entroy
, the part in the red box is always executed. So u and v are the same.At the same time, I'm also looking at HashNet's pytorch code implementation. And It also requires two sets to calculate the loss, but outputs1 and outputs2 in the figure below take two batches from the entire data, which are different.
So now I'm wondering why you set U and V to the same directly.
In the paper, h_i and h_j are also used to represent two sets, which are not the same.
I hope I can get your answer. Thank you.
The text was updated successfully, but these errors were encountered: