当前位置:网站首页>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 :
边栏推荐
- 深度学习系列46:人脸图像超分GFP-GAN
- 315. 计算右侧小于当前元素的个数
- Intentional shared lock, intentional exclusive lock and deadlock of MySQL
- 【STL】顺序容器之deque用法总结
- Verilog syntax explanation
- 300. longest increasing subsequence
- 306. 累加数
- redux Actions may not have an undefined “type“ property. Have you misspelled a constant?
- deeplab v3 代码结构图
- C language operator priority formula
猜你喜欢

js 判断两个数组增加和减少的元素

deeplab v3 代码结构图

【STL】关联容器之unordered_map用法总结

【BULL中文文档】用于在 NodeJS 中处理分布式作业和消息的队列包

Quartz调度框架的学习使用

MySQL的意向共享锁、意向排它锁和死锁

100 GIS practical application cases (79) - key points of making multi plan integrated base map

20220621 Dual Quaternion

【STL】顺序容器之deque用法总结

Analysis of personalized learning progress in maker Education
随机推荐
Specific help of OSI layered model to work
307. area and retrieval - array modifiable
【BULL中文文档】用于在 NodeJS 中处理分布式作业和消息的队列包
300. longest increasing subsequence
316. 去除重复字母
309. 最佳买卖股票时机含冷冻期
900. RLE 迭代器
Swagger3 integrates oauth2 authentication token
技术文章写作指南
Xshell7 Download
SSM整合
897. incremental sequential search tree
MySQL mvcc multi version concurrency control
redux Actions may not have an undefined “type“ property. Have you misspelled a constant?
js 判断两个数组增加和减少的元素
Add IPAD control function into shairplay
asp. Net file download demo and related problems
U-Net: Convolutional Networks for Biomedical Image Segmentation
896. 单调数列
【STL】关联容器之unordered_map用法总结