Skip to content

Stable Diffusion WebUI extension for fast and easy automatic creation of detailed character art.

License

Notifications You must be signed in to change notification settings

alexv0iceh/AutoChar

Repository files navigation

AutoChar - Version 0.9.5 is here!

https://civitai.com/models/95923/autochar-easy-character-art-creation-with-face-auto-inpaint

AutoChar Control Panel is a custom script for Stable Diffusion WebUI by Automatic1111 (1.6.0+) made to help newbies and enthusiasts alike achieve great pictures with less effort.
Basically, it's automation of my basic SD workflow for illustrations (check 'em here: https://t.me/dreamforge_tg) and also my Bachelor graduation work, for which I got an A. I've put decent emphasis in code readability and comments for it, so I hope it will help future contributors and developers of other scripts.

Please check my new guide for it on YouTube that explain all basic functions and pipeline: https://www.youtube.com/watch?v=jNUMHtH1U6E
For text description of scripts' basic idea check 0.9 version tab on CivitAI page.

Installation

Just put script and .onnx face recognition model in your stable-diffusion-webui/scripts folder
PLEASE, don't try to install via URL, it's not an extension, it won't be visible this way!
Also I highly recommend to download 4x-UltraSharp Upscaler (https://mega.nz/folder/qZRBmaIY#nIG8KyWFcGNTuMX_XNbJ_g) and put in /modes/ESRGAN folder

How to use, in short

  1. Go to your txt2img tab
  2. Write prompt, select basic parameters as usual (you don't need highres fix, since it's included in the algorithm)
  3. Select "AutoChar Beta 0.9" in dropdown menu Scripts in the lower part of page
  4. Click "Generate" and enjoy image

0.9.5 changes:

  • Fully revamped interface:
    • Info added for all crucial parameters, containing tips for usage and clarification for not-so-obvious functions
    • Upscaler choosing changed from check panels to dropdowns to reduce distraction
    • Function and slider groups divided to different blocks with clarification headers
  • True img2img mode: edit existing pictures with SD upscale and automatic face&eyes inpaint
  • Additional Advanced options!
  • Brand new Really Advanced options tab for brave enthusiasts willing to take complete control of AutoChar's generation pipeline and maximize their creativity
  • Various fixes:
    • Fixed infamous bug with OpenCV on inpaint step (If you STILL have it, do this: AUTOMATIC1111/stable-diffusion-webui#11727 (comment) )
    • Fixed inpaint only masked padding, drastically improving results on some artstyles and checkpoints
    • Fixed High-Res Fix upscalers' list, now it shows all available upscalers as it should
    • Styles from Styles Menu are now working properly
    • Many small fixes in code's logic and parameters

image

Comprehensive description of Advanced and Really Advanced options and tips for their usage:

  • Advanced options:
  • Quality functions:
    • Filtering function: sharpens and applies denoising filter to image after High-Res Fix to improve quality and reduce the number of necessary
      img2img steps. May negatively impact desired result on "noisy" and blurry artstyles. On by default
    • Inpaint only the biggest face on the image: does what it says, can be great to prevent undesired face detection and inpaint of background or body parts. May cause problems on images with small character head (full-height pictures and landscapes). In this case, either increase Face Recognition minimum confidence or disable this options. Also disable for pictures with two or more characters.On by default
    • Lower LoRA strength for face inpaint. Helps avoid burnout with strong LORAs: does what it says.On by default
    • Use DDIM sampler for better inpaint. Will use chosen in interface otherwise: better for detailed faces. Note that from SD WebUi's version 1.6.0+ denoising strength works differently for DMP++ samplers, so if you're disabling this option because of possible mask residue issues, consider increasing denoising strength for inpaint steps. On by default
    • Lower CFG for face inpaint. Helps avoid burning with multiple LoRAs: does what it says. Off by default
  • Algorithm-alterting functions:
    • Make face inpaint box larger to inpaint hair along with the face: does what it says. It can become quite VRAM heavy, so consider lowering Scaling factor for face inpainting if you're running into issues with it. Off by default
    • Do face inpaint after hair inpaint: does what it says. Off by default
    • Attempt mid-uspcale inpainting with chosen options: does what it says. Can be helpful for adding an additional level of detail. Off by default
    • Use plain Image2Image instead of SD Upscale: does what it says. Off by default
    • Don't use SD upscale and inpaint HRfix result. Great for weak GPUs: besides stated reason to use it, it can be useful to people accustomed to High-Res Fix-only pipeline.Off by default
  • Regulate denoise for each step:
    • All needed info is already in UI, but i would like to add that rom SD WebUi's version 1.6.0+ necessary denoise for DPM++ samplers is like x2 from DDIM denoise up to 0.5; E.g. 0.2 on DDIM is roughly the same as 0.4 on DPM++ 2M Karras
  • Sliders for parameters:
    • High-Res Fix scale factor: all info in UI
    • Strength of Filtering: intensity of Filtering function's effect. 0.3-0.5 works best, higher is tricky, but can be helpful for some artstyles
    • Multiplier for LoRA strength lowering: does what it says. Increase if you want to preserve more of artstyle from your LoRAs
    • Face Recognition minimum confidence: increase for stricter face detection, decrease if having problems on more anime-like artstyles
  • Really advanced options:
    • Tile Overlap parameter for SD Upscale, Scaling factor for face inpainting, Scaling factor for eyes inpainting: all info in UI
    • Algorithm's steps' settings:
      • Checkpoint: allows you to choose different one of your checkpoints to be used on this step. Great for mixing artstyles and combining best qualities of each checkpoint!
      • Sampler: obvious
      • Clip Skip: my use case is to generate base image on Сlip Skip 2 but work with it on later steps on Clip Skip 1 for better realism
      • Steps: obvious
      • Prompt & Negative prompt: allows you to use different prompts and LoRAs for each step. Like, using object or content LoRAs and exclude them from later steps, replacing with LoRAs that have great style, but negatively impact image's content if used in txt2img generation

image

Algorithm itself:

  1. Txt2img generation in chosen resolution
  2. High-res fix to boost details and gain sharpness
  3. [Optional, "on" by default] Filtering with chosen strength
  4. [Optional, "off" by default] Automatic inpainting of face and eyes with chosen parameters
  5. SD Upscale
  6. Automatic inpainting of face and eyes with chosen parameters

image

Coming in 1.0:

  • Release as full extension.
  • ControlNet integration.
  • More face recognition models (including anime-friendly) image

image

image