Skip to content

Improve Variations feature by freezing parts of the image #269

Description

@morganavr

Variations is a great feature if you tried it. It could be even better if it could accept image mask to freeze parts of the image you don't want to be changed - this is what this feature proposal is about.
Text


Possibly this feature could be implemented by providing mask image using code from this repo: https://github.com/basujindal/stable-diffusion/blob/main/optimizedSD/inpaint_gradio.py

Alternative solution is to generate a specific "noise array" with frozen pixels but I am not sure it's possible.
Thoughts on noise array are below.


Discussion about this new feature started in this PR:
Seed Fuzzing : #184 (comment)

Is it possible to construct such "noise array" from "seed fuzzing" PR that will change only a specific part of the image? It sounds like inpainting but it's a different type of inpainting (inside trained model without providing external source image).

While using that PR I noticed that very often I would love some part of the image to stay the same, and I could use brush and paint over parts of the image... :) So yeah, basically inpainting. But with this "seed fuzzing" feature. I imagine that separate PNG file with mask need to be created (mask is alpha values from 0 to 1, where 0 - don't change that part of the image, 1 - apply noise level specified by -v argument). Then script would convert that mask data into the information which pixels SD must not change on the final image.

If it is possible to map noise array to image pixels then this feature could be implemented.

img2img module already reads input image somehow and allows SD to generate variants.
Also there is mask feature (where you provide black and white image to specify areas to remove from the image).
They work somehow and inpainting (in some forms) is implemented in other forks of SD.
Is not these "facts" mean that there IS a way to create a match between pixels in the input image and SD internals?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions