/comfyui_segment_anything-1

Based on GroundingDino and SAM, use semantic strings to segment any element in an image. The comfyui version of sd-webui-segment-anything.

Primary LanguagePythonApache License 2.0Apache-2.0

ComfyUI Segment Anything

This project is a ComfyUI version of https://github.com/continue-revolution/sd-webui-segment-anything. At present, only the most core functionalities have been implemented. I would like to express my gratitude to continue-revolution for their preceding work on which this is based.

example

I have ensured consistency with sd-webui-segment-anything in terms of output when given the same input.

Requirements

Please ensure that you have installed Python dependencies using the following command:

pip3 install -r requirements.txt

Models

The models will be automatically downloaded when used. You can also manually download them according to the table below. If the automatic download is slow, you can set the HTTP_PROXY and HTTPS_PROXY environment variables to use a proxy.

GroundingDino

Please directly download the models and configuration files to the models/grounding-dino directory under the ComfyUI root directory, without modifying the file names.

name size config file model file
GroundingDINO_SwinT_OGC 694MB download link download link
GroundingDINO_SwinB 938MB download link download link

SAM

Please directly download the model files to the models/sams directory under the ComfyUI root directory, without modifying the file names.

name size model file
sam_vit_h 2.56GB download link
sam_vit_l 1.25GB download link
sam_vit_b 375MB download link
sam_hq_vit_h 2.57GB download link
sam_hq_vit_l 1.25GB download link
sam_hq_vit_b 379MB download link
mobile_sam 39MB download link

Contribution

Thank you for considering to help out with the source code! Welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!

If you'd like to contribute to this project, please fork, fix, commit and send a pull request for me to review and merge into the main code base.