Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/instance_seg' into instance_seg
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Aug 26, 2022
2 parents 6bec10e + 50dc739 commit 8029d56
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ def _make_grid(self, nx=20, ny=20, i=0, torch_1_10=check_version(torch.__version
t = self.anchors[i].dtype
shape = 1, self.na, ny, nx, 2 # grid shape
y, x = torch.arange(ny, device=d, dtype=t), torch.arange(nx, device=d, dtype=t)
if torch_1_10: # torch>=1.10.0 meshgrid workaround for torch>=0.7 compatibility
yv, xv = torch.meshgrid(y, x, indexing='ij')
else:
yv, xv = torch.meshgrid(y, x)
yv, xv = torch.meshgrid(y, x, indexing='ij') if torch_1_10 else torch.meshgrid(y, x) # torch>=0.7 compatibility
grid = torch.stack((xv, yv), 2).expand(shape) - 0.5 # add grid offset, i.e. y = 2.0 * x - 0.5
anchor_grid = (self.anchors[i] * self.stride[i]).view((1, self.na, 1, 1, 2)).expand(shape)
return grid, anchor_grid
Expand Down

0 comments on commit 8029d56

Please sign in to comment.