Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe what this pull request is trying to achieve.
This implements patchmatch which should allow for much better inpainting (and more notably outpainting) results.
Closes #4681
Additional notes and description of your changes
Requires
pypatchmatch
to be installed. This is currently only available on Windows via pip. Further install instructions are here.Mask blur
must be set to0
, because blurring breaks the seams that patchmatch tries to recover. There's probably better ways to blend the final image but I'm not sure what the correct solution for this should be. If you want you can play around with the individual passes before the final composite with #8814.I've also hardcoded the
patch_size
parameter to4
. Might want to expose this to the user, but increasing it also greatly increases computation time (the default is15
which takes far too long to run for practical purposes).Haven't tested with the openOutpaint extension yet but I'm hoping this addition could make big gains for that extension. Needs
4: "patch match"
added after this line. I think the extension does not currently expose the denoise parameter either, which probably needs to be done to yield good results.Opening as a PR for now since the installation process should be smoothed out before merging, and to see if it even works well in practice. Feedback appreciated.
Environment this was tested in