AI drawing practice (5): enlarge and repair old photos, mosaic photos, ID photos | Stable Diffusion becomes a productivity tool for designers

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 :

Can stable diffusion only be young ladies? No, today we restore old photos with stable diffusion.

The original image is a photo scan:
insert image description here

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.
insert image description here

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

insert image description here

  1. Pure amplification without parameters
    insert image description here
    actually has no effect~~haha

  2. Lanczos
    insert image description here
    keep noise

  3. Nearest
    insert image description here
    keeps the noise, the noise is a little bit sharper

  4. BSRGAN
    insert image description here
    noise is gone, the characters are relatively flat, and the picture is sharpened to a certain extent

  5. ESRGAN_4x
    insert image description here
    has obvious noise, vertical lines distribution, weaker contrast, reddish picture

  6. The noise of LDSR
    insert image description here
    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...) "

  7. R-ESRGAN 4x+
    insert image description here
    feels very AI, with clear lines and obvious sharpening

  8. R-ESRGAN 4x+Anime6B
    insert image description here
    woodblock AI, the lines are clearer, the sharpening is too obvious

  9. ScuNET
    insert image description here
    without noise, with blur effect

  10. ScuNET PSNR
    insert image description here
    has no noise, blur effect, and the contrast is slightly higher than the previous parameter.

  11. SwinIR_4x
    insert image description here
    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
insert image description here

Without other parameters, the photo size will not change.

  1. Value: 0.2
    insert image description here
    The effect is not obvious, the eyes are slightly more obvious

  2. Value: 0.5
    insert image description here
    In addition to clear eyes, the face is more detailed

  3. Value: 1
    insert image description here
    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.
insert image description here

Without other parameters, the photo size will not change.

  1. Value: 0.2
    insert image description here
    The noise of the face seems to be a little less

  2. Value: 0.5
    insert image description here
    The noise of the face is almost gone, and the transition between the face and the environment is softer

  3. Value: 1
    insert image description here
    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
insert image description here
picture
insert image description here
:
insert image description here

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

Guess you like

Origin blog.csdn.net/snans/article/details/130122766