Spaces:
Runtime error
Runtime error
jhj0517
commited on
Commit
•
8ab6ed9
1
Parent(s):
8d612b7
Check other condition too
Browse files
segment-anything-2/sam2/sam2_image_predictor.py
CHANGED
@@ -381,7 +381,11 @@ class SAM2ImagePredictor:
|
|
381 |
# we merge "boxes" and "points" into a single "concat_points" input (where
|
382 |
# boxes are added at the beginning) to sam_prompt_encoder
|
383 |
if concat_points is not None:
|
384 |
-
if concat_points[0].size(
|
|
|
|
|
|
|
|
|
385 |
logger.warning(" Box and point combination only works if there's "
|
386 |
"only one dot and one box. Using only the first one...")
|
387 |
concat_points = (concat_points[0][:, :1, :], concat_points[1][:, :1])
|
|
|
381 |
# we merge "boxes" and "points" into a single "concat_points" input (where
|
382 |
# boxes are added at the beginning) to sam_prompt_encoder
|
383 |
if concat_points is not None:
|
384 |
+
if (concat_points[0].size(0) > 1 or
|
385 |
+
concat_points[1].size(0) > 1 or
|
386 |
+
box_coords.size(0) > 1 or
|
387 |
+
box_labels.size(0) > 1):
|
388 |
+
|
389 |
logger.warning(" Box and point combination only works if there's "
|
390 |
"only one dot and one box. Using only the first one...")
|
391 |
concat_points = (concat_points[0][:, :1, :], concat_points[1][:, :1])
|