segment-anything icon indicating copy to clipboard operation
segment-anything copied to clipboard

segment multiple objects at the same time, the model is invalid

Open humorist6 opened this issue 1 year ago • 2 comments

Great job! Works fine when I enter an object box. But when I input multiple bboxes at one time, corresponding to different labels, and I want to segment these multiple objects at the same time, it seems that the model is invalid! Does it mean that only one object can be processed at a time, or is my way of chu wrong?

humorist6 avatar May 01 '23 04:05 humorist6

input the object boxes and labels as follows:

onnx_coord = np.array(boxes).reshape(-1, 2)[None, :, :]

onnx_label = np.repeat(np.arange(1,len(boxes)+1), 2)[None, :].astype(np.float32)

humorist6 avatar May 01 '23 04:05 humorist6

Thank you, batch reasoning with torch has been solved, I didn't look at the code example carefully, but I still don't know how to reason with multiple boxes when using onnx reasoning, thank you very much!

humorist6 avatar May 01 '23 15:05 humorist6

https://github.com/ByungKwanLee/Full-Segment-Anything addresses the ciritical issues of SAM, which supports batch-input on the full-grid prompt (automatic mask generation) with post-processing: removing duplicated or small regions and holes, under flexible input image size

ByungKwanLee avatar Oct 16 '23 07:10 ByungKwanLee