Skip to content

Instantly share code, notes, and snippets.

@arunm8489
Created June 4, 2020 04:47
Show Gist options
  • Save arunm8489/303086f868608cd707195d414390dcad to your computer and use it in GitHub Desktop.
Save arunm8489/303086f868608cd707195d414390dcad to your computer and use it in GitHub Desktop.
#log space transform height and the width
anchors = torch.FloatTensor(anchors)
if CUDA:
anchors = anchors.cuda()
anchors = anchors.repeat(grid_size*grid_size, 1).unsqueeze(0)
prediction[:,:,2:4] = torch.exp(prediction[:,:,2:4])*anchors #width and height
prediction[:,:,5: 5 + num_classes] = torch.sigmoid((prediction[:,:, 5 : 5 + num_classes]))
prediction[:,:,:4] *= stride
return prediction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment