Skip to content

Commit

Permalink
Merge pull request facebookresearch#58 from EndingCredits/main
Browse files Browse the repository at this point in the history
Fix baking original input size values to ONNX graph
  • Loading branch information
HannaMao authored Apr 9, 2023
2 parents efeab72 + e9f2d58 commit f58f1d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions segment_anything/utils/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def mask_postprocessing(self, masks: torch.Tensor, orig_im_size: torch.Tensor) -
align_corners=False,
)

prepadded_size = self.resize_longest_image_size(orig_im_size, self.img_size)
masks = masks[..., : int(prepadded_size[0]), : int(prepadded_size[1])]
prepadded_size = self.resize_longest_image_size(orig_im_size, self.img_size).to(torch.int64)
masks = masks[..., : prepadded_size[0], : prepadded_size[1]]

orig_im_size = orig_im_size.to(torch.int64)
h, w = orig_im_size[0], orig_im_size[1]
Expand Down

0 comments on commit f58f1d1

Please sign in to comment.