Skip to content

Commit b9d83a3

Browse files
harishsg99facebook-github-bot
authored andcommitted
Always detach tensor in visualization
Summary: Thanks for your contribution!. Fixed the following runtime Error : numpy() fails when visualizing an output element of a input batch during inference Pull Request resolved: #3400 Reviewed By: jonmorton Differential Revision: D30560943 Pulled By: ppwwyyxx fbshipit-source-id: abe94a12b67a5c8bad2a60fff989072f99b70d16
1 parent d67c7f3 commit b9d83a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

detectron2/utils/visualizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ def _convert_boxes(self, boxes):
11771177
Convert different format of boxes to an NxB array, where B = 4 or 5 is the box dimension.
11781178
"""
11791179
if isinstance(boxes, Boxes) or isinstance(boxes, RotatedBoxes):
1180-
return boxes.tensor.numpy()
1180+
return boxes.tensor.detach().numpy()
11811181
else:
11821182
return np.asarray(boxes)
11831183

0 commit comments

Comments
 (0)