Simplified fork focusing on quick segmentation using SAM (Segment Anything Model) and GroundingDINO.
This extension provides an easy-to-use interface for detecting and masking objects, body parts, clothing, and faces using AI-powered segmentation. Perfect for creating masks to use with img2img inpainting or other image editing workflows.
-
Quick Object Detection - One-click detection of:
- Full body, upper/lower body
- Face and facial features
- Hands and feet
- Clothing items (shirts, pants, dresses, etc.)
- Background
- Custom object detection via text prompts
-
AI-Powered Segmentation - Uses state-of-the-art models:
- SAM (Segment Anything Model) for precise mask generation
- GroundingDINO for text-based object detection
- Multiple SAM model options (standard, HQ, mobile)
-
Simple Workflow:
- Upload your image
- Select a preset (or enter custom prompt)
- Click "Generate Mask"
- Select the best mask from the results
- Click "Send to Inpaint Upload" to start editing immediately
-
Mask Customization:
- Adjustable detection threshold
- Mask expansion/dilation
- Combined mask option for multiple detections
- Invert mask option (great for background replacement)
- Open the extension in txt2img or img2img tabs (look for "Quick Segment" accordion)
- Select SAM model from the dropdown (will auto-download if not present)
- Upload your image
- Choose a preset from the dropdown:
- Full Body, Upper/Lower Body
- Face, Eyes, Nose, Mouth, Ears
- Hands, Feet
- Shirts, Pants, Dress, Shoes
- Or select "Custom" to enter your own text prompt
- Adjust settings (optional):
- Detection Threshold: Lower = more detections, Higher = stricter
- Mask Expansion: Expand mask edges (5-15 pixels recommended)
- Also Show Combined Mask: Adds an option to combine all detected regions
- Click "Generate Mask" and wait for results
- View results in the gallery:
- Each row shows: [Preview | Mask | Cutout] for each detection
- Send to Inpaint:
- Select the best mask using the radio buttons below the gallery
- (Optional) Check "Invert Mask" if you want to replace the background instead of the subject
- Click "📋 Send to Inpaint Upload"
- The extension will automatically switch you to the Inpaint Upload tab with your image and mask ready to go!
cd ${sd-webui}/extensions
git clone https://github.com/dmikey/sd-webui-quick-segmentOr install via the WebUI Extensions tab.
Choose one or more of the models below and put them to ${sd-webui}/models/sam or ${sd-webui-quick-segment}/models/sam. Do not change model name, otherwise this extension may fail due to a bug inside segment anything.
GroundingDINO models will be automatically downloaded on first use.
GroundingDINO Installation Issues:
- This extension uses local GroundingDINO by default to avoid C++/CUDA compilation issues
- If you encounter errors, go to Settings → Quick Segment → Enable "Use local groundingdino"
- Models are auto-downloaded from HuggingFace on first use
MPS/Apple Silicon Issues:
- If you encounter MPS errors on Mac, try launching with:
export PYTORCH_ENABLE_MPS_FALLBACK=1 - Or enable "Use CPU for SAM" checkbox in the UI (slower but more stable)
Memory Issues:
- Use smaller SAM models (sam_vit_b or mobile_sam) if you run out of VRAM
- Lower the detection threshold to get fewer detections
If you encounter a bug, please submit an issue. Please include your WebUI version, extension version, browser version, and any relevant error logs.
Pull requests are welcome!
This is a simplified fork of sd-webui-segment-anything by continue-revolution.
