-
-
Save arunm8489/97702555006da8362a7d76216b0dd7d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# x --> 4D feature map | |
batch_size = x.size(0) | |
grid_size = x.size(2) | |
# factor by which current feature map reduced from input | |
stride = inp_dim // x.size(2) | |
bbox_attrs = 5 + num_classes #5 + 80 | |
num_anchors = len(anchors) #3 | |
#eg detection input dimension [1, 255, 13, 13] | |
prediction = x.view(batch_size, bbox_attrs*num_anchors, grid_size*grid_size) # 1x255x169 | |
prediction = prediction.transpose(1,2).contiguous() #1x169x255 | |
prediction = prediction.view(batch_size, grid_size*grid_size*num_anchors, bbox_attrs) #1x507x85 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment