diff --git a/README.md b/README.md index f5006cb..f97c3a7 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,21 @@ # ComfyUI-RMBG -A ComfyUI custom node designed for advanced image background removal utilizing multiple models, including RMBG-2.0, INSPYRENET, and BEN. +A ComfyUI custom node designed for advanced image background removal and object segmentation, utilizing multiple models including RMBG-2.0, INSPYRENET, BEN, SAM, and GroundingDINO. $${\color{red}If\ this\ custom\ node\ helps\ you\ or\ you\ like\ my\ work,\ please\ give\ me⭐on\ this\ repo!}$$ $${\color{red}It's\ a\ greatest\ encouragement\ for\ my\ efforts!}$$ ## News & Updates +- 2024/12/23: Update ComfyUI-RMBG to v1.3.0 with new Segment node ( [update.md](https://github.com/1038lab/ComfyUI-RMBG/blob/main/update.md#v140-20241222) ) + - Added text-prompted object segmentation + - Support both tag-style ("cat, dog") and natural language ("a person wearing red jacket") prompts + - Multiple models: SAM (vit_h/l/b) and GroundingDINO (SwinT/B) (as always model file will be downloaded automatically when first time using the specific model) + - This update requires install requirements.txt + - 2024/12/12: Update Comfyui-RMBG ComfyUI Custom Node to v1.2.2 ( [update.md](https://github.com/1038lab/ComfyUI-RMBG/blob/main/update.md#v122-20241212) ) ![RMBG1 2 2](https://github.com/user-attachments/assets/cb7b1ad0-a2ca-4369-9401-54957af6c636) -- 2024/12/02: Update Comfyui-RMBG ComfyUI Custom Node to v1.2.1 ( [update.md](https://github.com/1038lab/ComfyUI-RMBG/blob/main/update.md#v121-20241202) ) +- 2024/12/02: Update Comfyui-RMBG ComfyUI Custom Node to v1.2.1 ( [update.md](https://github.com/1038lab/ComfyUI-RMBG/blob/main/update.mdv121-20241202) ) ![GIF_TO_AWEBP](https://github.com/user-attachments/assets/7f8275d5-06e5-4880-adfe-930f045df673) - 2024/11/29: Update Comfyui-RMBG ComfyUI Custom Node to v1.2.0 ( [update.md](https://github.com/1038lab/ComfyUI-RMBG/blob/main/update.md#v120-20241129) ) @@ -19,19 +25,28 @@ $${\color{red}It's\ a\ greatest\ encouragement\ for\ my\ efforts!}$$ ![comfyui-rmbg version compare](https://github.com/user-attachments/assets/2d23cf42-ca74-49e5-a8bf-9de377bd71aa) ## Features +- Background Removal (RMBG Node) + - Multiple models: RMBG-2.0, INSPYRENET, BEN + - Various background options + - Batch processing support + +- Object Segmentation (Segment Node) + - Text-prompted object detection + - Support both tag-style and natural language inputs + - High-precision segmentation with SAM + - Flexible parameter controls ![RMBG Demo](https://github.com/user-attachments/assets/f3ffa3c4-5a21-4c0c-a078-b4ffe681c4c4) ## Installation -1. install on ComfyUI-Manager, search `Comfyui-RMBG` and install. -![image](https://github.com/user-attachments/assets/419db32c-3e52-4276-bc83-7782363e0aa0) - Install the dependencies `requirements.txt` file within the ComfyUI-RMBG folder. +1. install on ComfyUI-Manager, search `Comfyui-RMBG` and install + install requirment.txt in the ComfyUI-RMBG folder ```bash ./ComfyUI/python_embeded/python -m pip install -r requirements.txt ``` -3. Clone this repository to your ComfyUI custom_nodes folder: +2. Clone this repository to your ComfyUI custom_nodes folder: ```bash cd ComfyUI/custom_nodes git clone https://github.com/1038lab/ComfyUI-RMBG @@ -42,8 +57,11 @@ git clone https://github.com/1038lab/ComfyUI-RMBG - Manually download the RMBG-2.0 model by visiting this [link](https://huggingface.co/briaai/RMBG-2.0/tree/main), then download the files and place them in the `/ComfyUI/models/RMBG/RMBG-2.0` folder. - Manually download the INSPYRENET models by visiting the [link](https://huggingface.co/1038lab/inspyrenet), then download the files and place them in the `/ComfyUI/models/INSPYRENET` folder. - Manually download the BEN model by visiting the [link](https://huggingface.co/PramaLLC/BEN), then download the files and place them in the `/ComfyUI/models/BEN` folder. +- Manually download the SAM models by visiting the [link](https://huggingface.co/1038lab/sam), then download the files and place them in the `/ComfyUI/models/SAM` folder. +- Manually download the GroundingDINO models by visiting the [link](https://huggingface.co/1038lab/GroundingDINO), then download the files and place them in the `/ComfyUI/models/grounding-dino` folder. ## Usage +### RMBG Node ![RMBG](https://github.com/user-attachments/assets/cd0eb92e-8f2e-4ae4-95f1-899a6d83cab6) ### Optional Settings :bulb: Tips @@ -75,6 +93,16 @@ git clone https://github.com/1038lab/ComfyUI-RMBG - `invert_output`: Flip mask and image output - `optimize`: Toggle model optimization +### Segment Node +1. Load `Segment (RMBG)` node from the `🧪AILab/🧽RMBG` category +2. Connect an image to the input +3. Enter text prompt (tag-style or natural language) +4. Select SAM and GroundingDINO models +5. Adjust parameters as needed: + - Threshold: 0.25-0.35 for broad detection, 0.45-0.55 for precision + - Mask blur and offset for edge refinement + - Background color options +

About Models

@@ -103,6 +131,26 @@ BEN is robust on various image types, offering: - Good balance between speed and accuracy - Effective on both simple and complex scenes - Suitable for batch processing + +## SAM +SAM is a powerful model for object detection and segmentation, offering: +- High accuracy in complex environments +- Precise edge detection and preservation +- Excellent handling of fine details +- Support for multiple objects in a single image +- Output Comparison +- Output with background +- Batch output for video + +## GroundingDINO +GroundingDINO is a model for text-prompted object detection and segmentation, offering: +- High accuracy in complex environments +- Precise edge detection and preservation +- Excellent handling of fine details +- Support for multiple objects in a single image +- Output Comparison +- Output with background +- Batch output for video
@@ -123,6 +171,8 @@ BEN is robust on various image types, offering: - RMBG-2.0: https://huggingface.co/briaai/RMBG-2.0 - INSPYRENET: https://github.com/plemeri/InSPyReNet - BEN: https://huggingface.co/PramaLLC/BEN +- SAM: https://huggingface.co/facebook/sam-vit-base +- GroundingDINO: https://github.com/IDEA-Research/GroundingDINO - Created by: [1038 Lab](https://github.com/1038lab) ## License