当前位置:网站首页>In depth learning series 46: face image super score gfp-gan
In depth learning series 46: face image super score gfp-gan
2022-06-23 07:12:00 【IE06】
1. Introduce
GFP-GAN By Tencent ARC Produced by the laboratory , The test results are very good .
The model is used to recover high-quality faces from low-quality faces . These lower quality portraits may be degraded for a variety of reasons , Such as low resolution , The noise , Blurred or compressed .
The mainstream image restoration technology is still against the generation network GAN, But how to use it well GAN It's a learning . This model uses generative facial prior model (Generative Facial Prior, GFP), The spatial feature transformation layer is incorporated into the face restoration process , This enables the method to achieve a good balance between authenticity and fidelity .
There are 3 individual pretrain Model , By default v1.3:
The general drawing of the model is as follows :
1.1 Degradation module

De degenerate the module into a UNet, stay UNet The decoder outputs an image at each resolution scale , Use L1 The loss function supervises the de degradation module .
1.2 Pretrained GAN as prior
take styleGAN Take the generator of and use it directly ~
1.3 Add spatial features
With the loss function reconstructed F s p a t i a l F_{spatial} Fspatial It can better improve the fidelity , As in the previous F G A N F_{GAN} FGAN Connect , The connection method is SFT.
1.4 Increase the loss of facial components 、 Loss of fidelity

Loss of fidelity use ArcFace Face recognition model .
2. Quick start
2.1 Address of the test
- https://huggingface.co/spaces/akhaliq/GFPGAN, Return only faces
- https://app.baseten.co/applications/Q04Lz0d/operator_views/8qZG6Bg,GPU backened, fast , And you can return to the full graph
- https://replicate.com/xinntao/gfpgan, Need to register , Return to full picture
- colab demo Address :https://colab.research.google.com/drive/1sVsoBd9AjckIXThgtZhGrHRfFI6UUYOo
2.2 github Address
https://github.com/TencentARC/GFPGAN
git clone https://github.com/TencentARC/GFPGAN.git
cd GFPGAN
pip install basicsr # For reasoning and training ,https://github.com/xinntao/BasicSR
pip install facexlib # For face detection ,https://github.com/xinntao/facexlib
pip install -r requirements.txt
python setup.py develop
pip install realesrgan # Non face region supersession , Use Real-ESRGAN
Then download the model , You can download it offline :
wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth -P experiments/pretrained_models no-check-certificate
To carry out reasoning :
python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2
The parameters are described as follows :
Usage: python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2 [options]...
-h show this help
-i input Input image or folder. Default: inputs/whole_imgs
-o output Output folder. Default: results
-v version GFPGAN model version. Option: 1 | 1.2 | 1.3. Default: 1.3
-s upscale The final upsampling scale of the image. Default: 2
-bg_upsampler background upsampler. Default: realesrgan
-bg_tile Tile size for background sampler, 0 for no tile during testing. Default: 400
-suffix Suffix of the restored faces
-only_center_face Only restore the center face
-aligned Input are aligned faces
-ext Image extension. Options: auto | jpg | png, auto means using the same extension as inputs. Default: auto
If you use cpu Words , There are several areas that need to be modified :
- inference_gfpgan.py in , allow cpu, And will half Change it to False:

Besides ,python3.7/site-packages/facexlib/utils Plus compatibility cpu Code for :
边栏推荐
- Configuration and compilation of mingw-w64, msys and ffmpeg
- RFID数据安全性实验:C#可视化实现奇偶校验、CRC冗余校验、海明码校验
- Run typescript code directly using TS node
- The illustration shows three handshakes and four waves. Xiaobai can understand them
- 【***数组***】
- TensorFlow中的数据类型
- Verilog syntax explanation
- asp. Net file download demo and related problems
- 295. 数据流的中位数
- .h5文件忘记数据库名字,使用h5py打印
猜你喜欢

Advanced drawing skills of Excel lecture 100 (VIII) -excel drawing WiFi diagram

406 double pointer (27. remove elements, 977. square of ordered array, 15. sum of three numbers, 18. sum of four numbers)

Analysis of personalized learning progress in maker Education
![[STL] summary of deque usage of sequential containers](/img/33/65c54d14697ee43b2655ea1255d67d.png)
[STL] summary of deque usage of sequential containers

Traversal of binary tree and related knowledge

C language learning summary

宝塔忘记密码

【日常训练】513. 找树左下角的值

Open source oauth2 framework for SSO single sign on

deeplab v3 代码结构图
随机推荐
【***数组***】
如何在 PHP 中进行日期格式验证检查(正则)
295. 数据流的中位数
[project training] change of linear arrow
The List
898. subarray bitwise OR operation
312. 戳气球
[project training 10] drawing of arrows
897. incremental sequential search tree
WPF command directive and inotifypropertychanged
关于#sql#的问题:有没有不增加字段,在原有字段的基础上,对字段里面的null值进行填充的方法呢
Endnote20 tutorial sharing (unfinished
Analysis of personalized learning progress in maker Education
301. delete invalid brackets
MySQL Redo log Redo log
901. stock price span
899. 有序队列
406 double pointer (27. remove elements, 977. square of ordered array, 15. sum of three numbers, 18. sum of four numbers)
paddle版本问题
318. 最大单词长度乘积