Skip to content

SDXL InPainting: Mask blur option is negated by forced binarization. #10690

@zacheryvaughn

Description

@zacheryvaughn

The SDXL InPainting pipeline's documentation suggests using pipeline.mask_processor.blur() for creating soft masks, but this functionality is effectively broken due to the implementation order. Please let me know if I'm missing something here. Based on my testing, whether I use a blurred mask or blur them with the built in method, they still show a solid seam as if there was no blur applied.

The mask processor is initialized with forced binarization:

self.mask_processor = VaeImageProcessor(
    vae_scale_factor=self.vae_scale_factor,
    do_normalize=False,
    do_binarize=True,  # Forces binarization
    do_convert_grayscale=True
)

When processing masks, any blur effect is applied before binarization, which then converts all values back to pure black and white, completely negating the blur effect (if I'm not mistaken). The VaeImageProcessor defaults binarize to false, but when masks are initialized it sets binarize to true.

Relevant files:
diffusers/stable_diffusion_xl/pipeline_stable_diffusion_xl_inpaint.py[326]
diffusers/image_processor.py[88][276][523]

Reproduction

Inpaint pipeline config using either your own blurred image or the built in blur method according to documentation. It's fairly self explanatory and I don't have a minimal script to share.

System Info

diffusers==0.32.2

Who can help?

@yiyixuxu @DN6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions