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
Hi Dr.
Thanks for the paper and code!
I have two questions about postive and negative samples for the JSD estimator mentioned in dim_losses.py
# Compute the positive and negative score. Average the spatial locations. E_pos = get_positive_expectation(u, measure, average=False).mean(2).mean(2) E_neg = get_negative_expectation(u, measure, average=False).mean(2).mean(2)
While calculating the E_pos and E_neg, all the inputs are the same --- u. I understand that the pos and neg samples should be distinguished before that, while why using the same u as the input here?
E_pos = (E_pos * mask).sum() / mask.sum() E_neg = (E_neg * n_mask).sum() / n_mask.sum()
Why do this? In code comments Since we have a big tensor with both positive and negative samples, we need to mask., I'm still confused about the mask, and the intention to operate E_neg * n_mask. How to generate neg samples?
Thanks!
The text was updated successfully, but these errors were encountered:
So the first two indices of u corresponds to the N x N scores across the entire batch. The diagonal corresponds to scores from the same image, off-diagonal are scores between two different images from the same batch. Positive samples are from the same image, and we "draw" these by simply pulling out the diagonal component of the positive scores. The negative samples are "drawn" by pulling the off-diagonal elements from the negative scores.
Hi Dr.
Thanks for the paper and code!
I have two questions about postive and negative samples for the JSD estimator mentioned in
dim_losses.py
# Compute the positive and negative score. Average the spatial locations. E_pos = get_positive_expectation(u, measure, average=False).mean(2).mean(2) E_neg = get_negative_expectation(u, measure, average=False).mean(2).mean(2)
While calculating the E_pos and E_neg, all the inputs are the same --- u. I understand that the pos and neg samples should be distinguished before that, while why using the same u as the input here?
E_pos = (E_pos * mask).sum() / mask.sum() E_neg = (E_neg * n_mask).sum() / n_mask.sum()
Why do this? In code comments
Since we have a big tensor with both positive and negative samples, we need to mask.
, I'm still confused about the mask, and the intention to operateE_neg * n_mask
. How to generate neg samples?Thanks!
The text was updated successfully, but these errors were encountered: