Skip to content

Commit

Permalink
Update general.py
Browse files Browse the repository at this point in the history
  • Loading branch information
alexchwong committed Dec 26, 2021
1 parent 6768003 commit 87d2f96
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,9 @@ def output_to_target(output, width, height):
targets = []
for i, o in enumerate(output):
if o is not None:
# sometimes output can be a list of tensor, so here ensure the type again, this fixes the error.
if isinstance(o, torch.Tensor):
o = o.cpu().numpy()
for pred in o:
box = pred[:4]
w = (box[2] - box[0]) / width
Expand Down

0 comments on commit 87d2f96

Please sign in to comment.