All images shown in this post are AI-generated! No works of real life artists were used.
You don't need to download this "model", but it contains an example. Just have a read if you don't need that.
If you find this guide helpful please leave a like~!
Obviously you'll need stable-diffusion-webui and a checkpoint relevant to the image in question's style (like AOM3 for anime based, Deliberate for realistic, whatever). If you use a VAE then you'll need that enabled too.
An image editor program (even MS Paint would work, but I'd recommend Krita, GIMP, Photoshop or whatever.
You may need Tiled VAE extension if you run into CUDA out of memory errors.
If you get a black spot instead on your masked area after hitting generate, put --no-half-vae in your webui-user.bat file's launch parameters and try again.
You need the image you want to decensor, it could range from a mosaic censor to outright clothing covering it; open it in your preferred image editor program.
In this example we will decensor the image by removing the panties, which is one of the hardest case scenarios you'll encounter for decensoring.
Draw a crappy sketch on the part you want to be decensored in your preferred image editor and save. You may skip this step and head to step 3 if the censored part is gaussian blur or mosaic that isn't too heavy.
It doesn't matter that much even if the colors are mostly flat and the details are mostly gone, the general color and approximate shape is important. However, some shading (especially on different body segments, which I kind of failed to do here) would improve results in step 3.
Okay, here's the fun part.
Plug the image from step 2 to inpainting under the img2img tab, then draw an inpaint mask on the sketched part. It should completely cover your sketched area.
Set mask blur to a low value (below 12) and masked padding to a high value (no less than 128, depending on how big your original image is). Set inpainting area to "only masked" and denoising to a moderate value (0.4~0.6 would do).
Width and height setting should be 768x768 or 512x512, or whatever really; just don't make it too big nor small. Note that the aspect ratio isn't dependent on the image as inpainting area is set to "only masked".
For prompts, put whatever that is supposed to be in the masked area is (like pussy
to positive prompt for this example) and don't forget to add quality control prompts (like masterpiece, best quality
in positive prompts and worst quality, bad anatomy
+ whatever to negative prompts, you get my point).
Note: you could try inpainting area to "whole picture" if you cannot get good results even with high padding value; keep that in mind that if you do this you'll have to set width and height to match the original image's ones.
If you get a black spot instead of anything else on your masked area after hitting generate, put --no-half-vae in your webui-user.bat file's launch parameters, reopen webui, then try again.
When that's all done, generate repeatedly until you get a result you consider good enough.
This result should have decensored the image, but the image will have seams between the inpainted area and areas that are not, hence step 4 is needed.
Now for the cleanup.
This step may be unnecessary if your result from step 3 looks clean enough, but that's unlikely.
Plug the image from step 3 back to inpainting, draw an inpainting mask at and around the place you did img2img in step 3.
Set mask blur to a high value (64) and mask padding to a moderate value (64~128). set inpainting area to "only masked" and denoising to a low value (0.25~0.35).
Don't forget about the width and height like in step 3.
For prompts, put whatever that is supposed to be in the masked area is and add quality control prompts, similar to step 3.
When you're ready, generate until you get a result you consider good enough.
After this step the seams should be mostly gone, and you are done!
Generally, generation from inpainting and img2img in general takes a lot of tries; so try to persist!
Keep getting body parts in masked area? Try increasing mask padding! If you want to make this slider go above 256, you need to edit the "ui-config.json" file; change the value for "img2img/Only masked padding, pixels/maximum" to something like 512. If that doesn't work, try setting inpainting area to "whole picture". If you do this you'll have to set the width and height to match the original image.
Out of VRAM, but using --medvram and --xformers already? Try this extension's Tiled VAE feature!
Getting black spots on your masked area and nothing else after generating? Try putting --no-half-vae in your webui-user.bat file's launch parameters and try again!
Let me know if you're confused about a step, or anything really. That's all for now, have fun~
FaceRestore node for ComfyUI. To install copy the facerestore directory from the zip to the custom_nodes directory in ComfyUI.
I bodged this together in an afternoon. You might need to pip install a package if it doesn't work at first.
You'll need codeformer-v0.1.0.pth
or GFPGANv1.4.pth
in your models/upscale_models
directory. The node uses another model for face detection which it will download and put in models/facedetection
webui-user.bat Fix Error
https://www.pixiv.net/artworks/107731864
My setting:
@echo off
set PYTHON="C:\Users\admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.10\Python 3.10 (64-bit).lnk"
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--xformers --no-half-vae --no-half --theme dark --disable-safe-unpickle
git pull
call webui.bat