Skip to content

Instantly share code, notes, and snippets.

@SannaPersson
Created March 21, 2021 10:47
Show Gist options
  • Save SannaPersson/f4f3163ca300d5888b094a90f92588ce to your computer and use it in GitHub Desktop.
Save SannaPersson/f4f3163ca300d5888b094a90f92588ce to your computer and use it in GitHub Desktop.
predictions[..., 1:3] = self.sigmoid(predictions[..., 1:3]) # x, y, coordinates
target[..., 3:5] = torch.log(1e-16 + target[..., 3:5] / anchors) # convert target width and height
box_loss = self.mse(predictions[..., 1:5][obj], target[..., 1:5][obj]) #index by obj to only apply loss for objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment