Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion training/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ def BCELogit_Loss(score_map, labels):
loss (scalar torch.Tensor): The BCE Loss with Logits for the score map and labels.
"""
labels = labels.unsqueeze(1)
"""
The choices for the parameter reduction of the function torch.nn.functional.binary_cross_entropy_with_logits in pytorch 0.4.1 are 'none'|‘elementwise_mean’ | ‘sum’.
"""
loss = F.binary_cross_entropy_with_logits(score_map, labels[:, :, :, :, 0],
weight=labels[:, :, :, :, 1],
reduction='mean')
reduction='elementwise_mean')
return loss