-
-
Save SannaPersson/008f516f6885c8c97bba84f0a505f569 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anchors = anchors.reshape(1, 3, 1, 1, 2) # reshaping for broadcasting | |
box_preds = torch.cat([self.sigmoid(predictions[..., 1:3]), torch.exp(predictions[..., 3:5]) * anchors], dim=-1) | |
ious = intersection_over_union(box_preds[obj], target[..., 1:5][obj]).detach() | |
object_loss = self.bce((predictions[..., 0:1][obj]), (ious * target[..., 0:1][obj])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment