S: Did you install stable diffusion just to see the young lady?
I: Of course not, of course it is for the development of the company to find a way out~~
Learn in advance :
- Installation and problem solving reference: " Windows installation Stable Diffusion WebUI and problem solving records ";
- Problems when running and using " Sorting out various problems encountered when Windows uses Stable Diffusion ";
- Model application and parameters " Stable Diffusion Personally Recommended Various Models, Setting Parameters, Extended Applications, etc. Collection ";
- Prompt Words Create Spells " AI Drawing Prompt Words/Spells/Affixes/Keywords Usage Guide (Stable Diffusion Prompt Designer Operation Manual) ";
- Different types of models Models description " Analysis of different types of StableDiffusion model Models ";
- Draw character movements and details of hands and feet " Stable Diffusion Accurately draw character movements and details of hands and feet (ControlNet extension required) ";
- Comparison of various styles and practical application " AI drawing style comparison table / detailed research records and experience summary of drawing style samples ";
Can stable diffusion only be young ladies? No, today we restore old photos with stable diffusion.
The original image is a photo scan:
Usually, we usually use high-definition restoration to enlarge the picture when creating pictures, so should we use the picture-making mode for existing old photos? Yes, but it is used in this article 附加功能
, and it is also recommended that you use this function as much as possible when zooming in on photos. It not only saves video memory, but more importantly, it is fast!
1. Additional functions
Select old photos and put them in the image area with additional functions.
2. Parameter setting
parameter name | Role introduction | Introduction or study reference |
---|---|---|
Upscaler1 | Enlarge the picture with Algorithm 1 | Lanczos/Nearest/BSRGAN/ESRGAN_4x/LDSR/R-ESRGAN 4x+/R-ESRGAN 4x+ Anime6B/ScuNET/ScuNET PSNR/SwinIR 4x |
Upscaler2 | Enlarge the picture with Algorithm 2 | You can choose a slightly blurred algorithm, so that the generated pictures will be more natural, not very AI |
Upscaler 2 visibility | The weight of Algorithm 2 relative to Algorithm 1 when enlarging the image | 0 means no algorithm 2, 1 means complete |
GFPGAN Visibility | Face repair function | Artifact! Face Restoration Module for Old Photos in Python—GFPGAN |
CodeFormer Visibility | Mosaic repair function | CodeFormer: The strongest AI mosaic removal artifact on the surface! (with practical tutorial) |
CodeFormer weights | When it is 0, the effect is the largest, and when it is 1, the effect is the smallest |
1. Upscaler
Different algorithms produce different results
-
Pure amplification without parameters
actually has no effect~~haha -
Lanczos
keep noise -
Nearest
keeps the noise, the noise is a little bit sharper -
BSRGAN
noise is gone, the characters are relatively flat, and the picture is sharpened to a certain extent -
ESRGAN_4x
has obvious noise, vertical lines distribution, weaker contrast, reddish picture -
The noise of LDSR
is obvious, the noise is thicker, and the contrast between light and dark of the face is slightly higher than the previous parameter.
When using LDSR, it may prompt that the ssl certificate is incorrect. Please refer to this article to modify the code: " Various problems and knowledge points encountered when Windows uses Stable Diffusion (updating...) " -
R-ESRGAN 4x+
feels very AI, with clear lines and obvious sharpening -
R-ESRGAN 4x+Anime6B
woodblock AI, the lines are clearer, the sharpening is too obvious -
ScuNET
without noise, with blur effect -
ScuNET PSNR
has no noise, blur effect, and the contrast is slightly higher than the previous parameter. -
SwinIR_4x
has no noise, the characters are clear, the edges of the color blocks are slightly sharpened, and there are red eyes
2. GFPGAN for facial restoration
A kind of restoration that is more integrated with the original picture and the environment, not very self-assessed
Without other parameters, the photo size will not change.
-
Value: 0.2
The effect is not obvious, the eyes are slightly more obvious -
Value: 0.5
In addition to clear eyes, the face is more detailed -
Value: 1
The whole face is very clear, in sharp contrast to the rest of the mosaic
3. CodeFormer for facial restoration
It has the effect of removing noise and mosaic, but it will add "self-awareness" when increasing the weight, and the face may not match the original image.
Without other parameters, the photo size will not change.
-
Value: 0.2
The noise of the face seems to be a little less -
Value: 0.5
The noise of the face is almost gone, and the transition between the face and the environment is softer -
Value: 1
The face is clear, but it also becomes different from the original face, adding AI's own imagination~~
3. Comprehensive drawing
(ScuNET) Blur enlargement -> (BSRGAN) Edge sharpening -> (GFPGAN) face repair a little bit, but not excessive -> (CodeFormer) make corrections and output the picture to compare with the original
picture
:
As long as the visibility of GFPGAN and CodeFormer does not exceed about 0.35, the results are generally similar, and the transition is softer.
Preserving noise, blurring, sharpening, etc. are all styles, and you can set parameters according to actual needs.
Finally, have you read this content yet? AI drawing practice (4): related pictures png and icon icon used in making food safety PPT | Stable Diffusion becomes a productivity tool for designers