AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.45k stars 26.44k forks source link

Apply Image segmentation to mask a specific area for inpainting alternate to manual masking. #3222

Open Muhammad-Zubair opened 1 year ago

Muhammad-Zubair commented 1 year ago

Is there an existing issue for this?

What would your feature do ?

What if we Use model like yolov4 to detect objects in an image then create mask (or even delete the unwanted object or area) and then inpaint which will be much better and accurate. also image segmentation is much easier than text to mask or masking with brush, with just one click away let the model do object detection and masking so inpainting process will be like this:

-> detect an object with yolov4 or any other highly accurate model -> create mask with U-Net , FastFCN, MaskRCNN (which ever model full fill the purpose best) -> ( if it give us good result delete the object or area from image) -> inpaint the masked area ( with text to img)

Proposed workflow

  1. Object Detection
  2. Masking (or deletion of unwanted object or area)
  3. Inpainting
Ehplodor commented 1 year ago

I'll add this to the list https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/2940

winterspringsummer commented 1 year ago

I'm not sure if this is what you are looking for, but there is a custom scripts for selecting area by text - txt2mask https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts#txt2mask

Muhammad-Zubair commented 1 year ago

I'm not sure if this is what you are looking for, but there is a custom scripts for selecting area by text - txt2mask https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts#txt2mask image segmentation is much easier than text to mask with just one click away let the work done by image segmentation model or even yolov4 or yolov5 models like that can be used to: -> detect an object with yolov4 or any other highly accurate model -> create mask with U-Net , FastFCN, MaskRCNN (which ever model full fill the purpose best) -> inpaint the masked object