Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement After Detailer's diffusers pipeline ‘asdiff’ #66

Open
davidiwharper opened this issue Dec 19, 2023 · 2 comments
Open

Implement After Detailer's diffusers pipeline ‘asdiff’ #66

davidiwharper opened this issue Dec 19, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@davidiwharper
Copy link

davidiwharper commented Dec 19, 2023

Background
After Detailer is a plugin that provides a major generation upgrade for Stable Diffusion, being able to fix faces, hands, and (with third party plugins) other image elements; a fair number of models on Civitai now recommend ADetailer, and I imagine that the need to implement this feature will continue to increase over time.

To my knowledge, ADetailer is currently only available for general use in the Automatic Web UI and its siblings (e.g. SD.Next). While sdkit has support for face restoration, After Detailer's post-upscale inpainting approach can give much higher quality result for faces, and deal with the dreadful hand problems that plague Stable Diffusion far more effectively than anything sdkit and its downstream end-user interfaces – most notably Easy Diffusion – have to offer.

Proposed Solution
The developers of adetailer have released a diffusers pipeline, asdiff. There is a very basic python/diffusers sample in the GitHub repository.

It would be most helpful to implement asdiff as an alternative filter, in a similar manner as CodeFormer. The default settings would probably be:

  1. Use the same checkpoint and prompts as in the original
  2. Do a run with face_yolov8n.pt
  3. Do a run with hand_yolov8n.pt

It would be helpful to integrate some of adetailer’s key options into sdkit as well as these defaults, most allowing the selection of particular models (face, hand, third-party etc.) and the controlnet model used; I suppose it would also be worth considering whether to allow the user to specify a custom checkpoint model to be used for inpainting (e.g. the -inpainting variant of the generation checkpoint). Perhaps in the future such tinkering could be exposed to Easy Diffusion users via a UI extension.

Alternatives
I am unaware of any alternatives to ADetailer (e.g. uuDetailer) that could be implemented in diffusers.

Additional Context
If I understand sdkit/filter/codeformer/init.py correctly, sdkit’s codeformer implementation is somehow integrated with the upscaler. I’m not sure how this (and tiling) will work with asdiff/adetailer, which I believe prefers to fix the upscaled image. I suppose it is possible that memory requirements may mean that ADetailer is incompatible with the Low VRAM option in Easy Diffusion.

As the same checkpoint is typically used for inpainting in basic ADetailer runs (notwithstanding the reference to Counterfeit in the sample), I hope that these risks are not excessive. Perhaps ADetailer could be run on multiple tiles rather than the full image in scenarios where there is insufficient VRAM?

@davidiwharper davidiwharper added the enhancement New feature or request label Dec 19, 2023
@HughMungis
Copy link

bump

@cmdr2
Copy link
Contributor

cmdr2 commented Sep 26, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants