Skip to content

Commit b344e66

Browse files
Added to return pixel coordinates of masks (#129)
Added to return pixel coordinates of masks
1 parent 15a8211 commit b344e66

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

samgeo/text_sam.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ def predict(
233233
dtype=np.uint8,
234234
save_args={},
235235
return_results=False,
236+
return_coords=False,
236237
**kwargs,
237238
):
238239
"""
@@ -322,6 +323,13 @@ def predict(
322323
if return_results:
323324
return masks, boxes, phrases, logits
324325

326+
if return_coords:
327+
boxlist = []
328+
for box in self.boxes:
329+
box = box.cpu().numpy()
330+
boxlist.append((box[0], box[1]))
331+
return boxlist
332+
325333
def predict_batch(
326334
self,
327335
images,

0 commit comments

Comments
 (0)