From 567662b0fd33ca4b022d94d3b8de896628cd32dd Mon Sep 17 00:00:00 2001
From: Eric Mintun <eric.mintun@gmail.com>
Date: Sat, 15 Apr 2023 10:40:48 -0700
Subject: [PATCH] Fix incorrect shape in ResizeLongestSide.apply_image_torch.

---
 segment_anything/utils/transforms.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/segment_anything/utils/transforms.py b/segment_anything/utils/transforms.py
index 97a682a..c08ba1e 100644
--- a/segment_anything/utils/transforms.py
+++ b/segment_anything/utils/transforms.py
@@ -59,7 +59,7 @@ class ResizeLongestSide:
         the transformation expected by the model.
         """
         # Expects an image in BCHW format. May not exactly match apply_image.
-        target_size = self.get_preprocess_shape(image.shape[0], image.shape[1], self.target_length)
+        target_size = self.get_preprocess_shape(image.shape[2], image.shape[3], self.target_length)
         return F.interpolate(
             image, target_size, mode="bilinear", align_corners=False, antialias=True
         )