Skip to content

Commit

Permalink
Fix yolo for torch.onnx.export (WongKinYiu#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
triple-Mu authored Jul 26, 2022
1 parent b3c4165 commit 7a7cba7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def forward(self, x):
y[..., 2:4] = (y[..., 2:4] * 2) ** 2 * self.anchor_grid[i] # wh
else:
xy = (y[..., 0:2] * 2. - 0.5 + self.grid[i]) * self.stride[i] # xy
wh = (y[..., 2:4] * 2) ** 2 * self.anchor_grid[i] # wh
wh = (y[..., 2:4] * 2) ** 2 * self.anchor_grid[i].data # wh
y = torch.cat((xy, wh, y[..., 4:]), -1)
z.append(y.view(bs, -1, self.no))

Expand Down

0 comments on commit 7a7cba7

Please sign in to comment.