segment-anything-models-java/SAMJ-IJ

[enhancement] Add Grid option to segment multiple objects in a region

rdemets opened this issue · 4 comments

Would it be possible to add a Grid of points option, similar to what Meta offers on their website for selection of multiple objects within a region of the image ?

I tried the Rect, but it tends to give a single ROI of a size close to the drawn rectangle.

Regards, Richard.

Hi Richard,

You are correct; the rectangle will only give you a single ROI of the rectangle's size and will not annotate multiple objects within the same ROI.

At the moment, the grid option you mentioned is not implemented. Performing inference with SAM-like models without a prompt is something we've also considered! Remember, it's an early release, and there might be more features to come!

Thank you for your input!

Best,
Caterina

It's in the roadmap! Thanks for the feedback @rdemets

I'm wondering that I would open up the API of our SAMJ in the sense that it would be possible to users to provide programatically their own sets of points.

Currently, you can start SAMJ Annotator from the Jython scripting in Fiji

from ai.nets.samj.ij import SAMJ_Annotator
SAMJ_Annotator().run()

which I would modify to something like:

from ai.nets.samj.ij import SAMJ_Annotator
samj = SAMJ_Annotator()
samj.run()
samj.promptThesePoints([[10,10],[10,20],[x,y],...])

The last command would act as if clicking points at coordinates 10,10; 10,20; .... except that does not need to click, but e.g. generate points into a shape of some grid... ;-)
(the actual code snippet will likely change... always looks easier at the beginning, you know)

but I can't manage this week, fully overbooked... not to build any false hopes (sorry)