Skip to content

Commit

Permalink
Fixed single bbox bug (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs authored Aug 30, 2023
1 parent f66b3e4 commit 738f235
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion samgeo/hq_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,9 @@ def predict(

self.boxes = input_boxes

if boxes is None or (not isinstance(boxes[0], list)):
if boxes is None or (len(boxes) == 1) or (len(boxes) == 4 and isinstance(boxes[0], float)):
if isinstance(boxes, list) and isinstance(boxes[0], list):
boxes = boxes[0]
masks, scores, logits = predictor.predict(
point_coords,
point_labels,
Expand Down
4 changes: 3 additions & 1 deletion samgeo/samgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,9 @@ def predict(

self.boxes = input_boxes

if boxes is None or (not isinstance(boxes[0], list)):
if boxes is None or (len(boxes) == 1) or (len(boxes) == 4 and isinstance(boxes[0], float)):
if isinstance(boxes, list) and isinstance(boxes[0], list):
boxes = boxes[0]
masks, scores, logits = predictor.predict(
point_coords,
point_labels,
Expand Down

0 comments on commit 738f235

Please sign in to comment.