Guide Stable Diffusion WebUI - INPAINTING Automatic detection and Batch process using Replacer extension

  • Welcome to the Fakes / AI / Deepfakes category
    When posting AI generated content please include prompts used where possible.

mistercoomer

Bathwater Drinker
Sep 23, 2022
110
2,796
1,252
0fya082315al84db03fa9bf467e3.png
First of all, I am not a technical guy, just stumbled upon this and wanted to share. I won't be able to help you with any major errors, but I will help if I can.


This is just a simple guide for using Replacer extension for AUTOMATIC1111's SD WebUI. For setting up WebUI I would recommend this guide - https://simpcity.su/threads/installing-stable-diffusion-webui-nudifying-inpainting-guide.140142/


In WebUI, go to 'Extensions' tab and download
1. sd-webui-replacer &
2. sd-webui-segment-anything

3. Apply and Reload UI


Download these models

1. Good NSFW model - Uberrealistic PornMerge -
Please, Log in or Register to see links and images


Download a. Pruned model or Full model and b. Config, save both to 'webui\models\Stable-diffusion'

2. Segmenting Model -
Please, Log in or Register to see links and images


Save it to 'webui\extensions\sd-webui-segment-anything\models\sam'


Again in WebUI, go to Replacer Tab
Enter prompts
Detection Prompt - <dress type - bikini, t-shirt etc>
Positive prompt - RAW image of a nude woman, naked
Negative prompt - ((clothing), (monochrome:1.3), (deformed, distorted, disfigured:1.3), (hair), tattoo, wet, water, clothing, shadow, 3d render, cartoon, ((blurry)), duplicate, ((duplicate body parts)), (disfigured), (poorly drawn), ((missing limbs)), logo, signature, text, words, low res, boring, artifacts, bad art, gross, ugly, poor quality, low quality, poorly drawn, bad anatomy, wrong anatomy

Please, Log in or Register to see links and images


In Advanced options, set your preferences

Please, Log in or Register to see links and images
Please, Log in or Register to see links and images


Enter image location

and Run

It will automatically detect and replace with positive prompt. You can do videos too, but it will take time, unless you have a good enough rig.

Also read through
1.
Please, Log in or Register to see links and images

2.
Please, Log in or Register to see links and images
 
Last edited:

mkswolft

Bathwater Drinker
Mar 12, 2022
153
5,285
1,252
0fya082315al84db03fa9bf467e3.png
hi, I have this error

File "C:\Users\Desktop\SD 2.0\webui\extensions\sd-webui-segment-anything\scripts\dino.py", line 39, in verify_dll
from groundingdino import _C
ImportError: cannot import name '_C' from 'groundingdino' (C:\Users\Desktop\SD 2.0\webui\venv\lib\site-packages\groundingdino\__init__.py)
Failed to build dymanic library. Will uninstall GroundingDINO from pip and fall back to local groundingdino this time. Please permanently switch to local groundingdino on Settings/Segment Anything or submit an issue to
Please, Log in or Register to see links and images
.
Uninstalling sd-webui-segment-anything requirement: groundingdino
Running GroundingDINO Inference

It's like it uninstalls and installs that, whatever it is, over and over again between each image, do you know what it could be? It takes approximately 1 minute for each image for that reason but when generating the mask and the new image it only takes 10 seconds, the difference is big
I'm not very technical in programming, I followed your tutorial and found some possible
Please, Log in or Register to see links and images
on
Please, Log in or Register to see links and images
but I'm not going to lie I didn't understand anything
thanks in advance 🙏
 

mistercoomer

Bathwater Drinker
Sep 23, 2022
110
2,796
1,252
0fya082315al84db03fa9bf467e3.png
download groundingdino from
Please, Log in or Register to see links and images


download 'groundingdino_swint_ogc.pth' & 'GroundingDINO_SwinT_OGC.cfg.py'

place them in '...\sd.webui\webui\extensions\sd-webui-segment-anything\models\grounding-dino'

in webui, go to settings & search for groundingdino
check
'Use local groundingdino to bypass C++ problem'
apply

in replacer tab, advanced settings>detection>groundingdino model>select the above downloaded model.
 
  • PeepoLove
Reactions: mkswolft

zxc753

Lurker
Mar 13, 2022
5
0
46
0fya082315al84db03fa9bf467e3.png
Thanks to mistercoomer for the instructions!
I would like to add a few notes.
- if an error appears during the generation process
ModuleNotFoundError: No module named 'addict'
then in cmd enter the following command
D:\stable-diffusion-portable-main\venv\Scripts\python.exe -m pip install addict
It could be something else instead of “addict”. And don't forget to change the path.
- The default settings can be changed via the “ui-config.json” file in the root folder.
We are interested in the following lines. In “” specify the prompt you need
“Replacer/Detection prompt/value”: “”,
“Replacer/Positive prompt/value”: “”,
“Replacer/Negative prompt/value”: “””,
- if the error “CUDA ERROR LAUNCH TIMEOUT” appears during generation then make changes to the registry according to the instructions:

- don't forget that you can not only undress girls. Add “legs” to the detection prompt and “stockings” to the positive prompt and the girl will end up wearing stockings. Etc.

upd:
I strongly recommend experimenting with the parameters of the "webui-user.bat" file. With default settings 1 photo was generated for 2-4 minutes. After I added "--medvram" - it became 30-50 seconds. What exactly I suggest
- install the "sd-extension-system-info" extension, click "Apply and restart UI", go to "System Info - Benchmark - quick - Run benchmark". You are interested in the "perfomance" indicator in the second column. The closer it is to "1" the better. After each change of the "webui-user.bat" file, run benchmark and see what is more efficient. What's definitely worth checking:
- "--opt-sdp-attention" or "--xformers" (you can do both at the same time, but it seems to be advised to put one or the other).
- Be sure to try "--medvram" and "--lowvram" in turn, especially if you have a weak video card.
I have NVIDIA GeForce GTX 970 (with 4 Gb VRAM) and for me I set it like this:
set COMMANDLINE_ARGS=---xformers --autolaunch --medvram
 
Last edited:

cukibautai

Fan
Dec 5, 2021
5
95
325
0fya082315al84db03fa9bf467e3.png
Thanks but after many errors i find it easier to follow their official repo
Please, Log in or Register to see links and images

after that i follow your instruction works really well 😘
 

zxc753

Lurker
Mar 13, 2022
5
0
46
0fya082315al84db03fa9bf467e3.png
- How to disable pubic hair completely? I changed “(hair)” to “(((hair)))” in the original negative prompt, but it didn't work. I added “public hair” to the end - it doesn't work either - sometimes there is no hair at all, and sometimes there is a small bush.
- Does it make sense to reduce the length and width of the original pictures? I didn't notice any difference. And sometimes smaller images took longer to process.