Skip to content

Commit

Permalink
Fixed issue where no elements in batch contain a target
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexanders101 committed Jul 9, 2023
1 parent 9f161a3 commit ad35557
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def training_step(self, batch: Batch, batch_nb: int) -> Dict[str, Tensor]:

# Take the weighted average of the symmetric loss terms.
masks = masks.unsqueeze(1)
symmetric_losses = (weights * symmetric_losses).sum(-1) / masks.sum(-1)
symmetric_losses = (weights * symmetric_losses).sum(-1) / torch.clamp(masks.sum(-1), 1, None)
assignment_loss, detection_loss = torch.unbind(symmetric_losses, 1)

# ===================================================================================================
Expand Down

0 comments on commit ad35557

Please sign in to comment.