Skip to content

Commit 738f235

Browse files
authored
Fixed single bbox bug (#184)
1 parent f66b3e4 commit 738f235

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

samgeo/hq_sam.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,9 @@ def predict(
573573

574574
self.boxes = input_boxes
575575

576-
if boxes is None or (not isinstance(boxes[0], list)):
576+
if boxes is None or (len(boxes) == 1) or (len(boxes) == 4 and isinstance(boxes[0], float)):
577+
if isinstance(boxes, list) and isinstance(boxes[0], list):
578+
boxes = boxes[0]
577579
masks, scores, logits = predictor.predict(
578580
point_coords,
579581
point_labels,

samgeo/samgeo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,9 @@ def predict(
570570

571571
self.boxes = input_boxes
572572

573-
if boxes is None or (not isinstance(boxes[0], list)):
573+
if boxes is None or (len(boxes) == 1) or (len(boxes) == 4 and isinstance(boxes[0], float)):
574+
if isinstance(boxes, list) and isinstance(boxes[0], list):
575+
boxes = boxes[0]
574576
masks, scores, logits = predictor.predict(
575577
point_coords,
576578
point_labels,

0 commit comments

Comments
 (0)