Hysen Labs
Open-source project
DCDmllm/InstructSAM avatar
DCDmllm

InstructSAM

The code for "InstructSAM: Segment Any Instance with Any Instructions"

100 stars7 forksPythonLicense varies
01
DEEP OPEN-SOURCE ANALYSIS

InstructSAM: segmenting from instructions

Code for InstructSAM, an instruction driven segmentation framework that takes category prompts, referring expressions, or reasoning style instructions and outputs a set of instances.

02
DEEP OPEN-SOURCE ANALYSIS

What the framework accepts

InstructSAM is an instruction driven multi instance segmentation framework, and the code corresponds to a paper on segmenting any instance with any instructions. Inputs can be category prompts, referring expressions, or reasoning style instructions, and the output is a predicted set of instances rather than a single mask. That flexibility is the core of what the framework is offering.

03
DEEP OPEN-SOURCE ANALYSIS

Getting the data

Training annotation JSONs are hosted on Hugging Face and go under the data training directory. Evaluation annotation JSONs are also on Hugging Face and belong in the data eval directory. Download and place them in the right folders, and the data side of the setup is done.

04
DEEP OPEN-SOURCE ANALYSIS

Efficient inference

The framework advertises efficient inference that avoids multi round agentic prompting and repeated SAM calls. It also supports the Inst2Seg dataset, with training and evaluation scripts for instruction based instance segmentation, so the repo covers the full workflow rather than just the model.

05
DEEP OPEN-SOURCE ANALYSIS

Running evaluation

Before evaluation, the dataset roots in each script need editing. The Python evaluation files take explicit image folder and question file arguments instead of relying on machine specific defaults, which keeps the evaluation reproducible across machines.

06
DEEP OPEN-SOURCE ANALYSIS

The community C++ port

A third party contribution provides instructSAM as a native C++ ggml port for CPU only inference. A Docker one liner runs the whole thing end to end in about 1.7 minutes on a 12 core laptop and converts the InstructSAM 2B weights to GGUF at build time, which makes the model usable without a GPU.

08
DEEP OPEN-SOURCE ANALYSIS

Official sources

09
Community notes

Community notes