当前位置:网站首页>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 :
边栏推荐
- Badly placed()'s problem
- 897. incremental sequential search tree
- C DPI adaptation problem
- 316. remove duplicate letters
- 别找了诸位 【十二款超级好用的谷歌插件都在这】(确定不来看看?)
- 897. incremental sequential search tree
- 316. 去除重复字母
- [project training] multi segment line expanded to parallel line
- U-Net: Convolutional Networks for Biomedical Image Segmentation
- Interpreting the spirit of unity and cooperation in maker Education
猜你喜欢

MySQL MVCC多版本并发控制

JUnit unit test reports an error org junit. runners. model. InvalidTestClassError: Invalid test class ‘xxx‘ . No runnable meth

Eureka

【STL】pair用法总结

TensorFlow中的数据类型

deeplab v3 代码结构图

Interpreting the spirit of unity and cooperation in maker Education

20220621 Three Conjugates of Dual Quaternions

MySQL mvcc multi version concurrency control

Eureka
随机推荐
【项目实训】多段线扩充为平行线
309. 最佳买卖股票时机含冷冻期
TP6 安装拓展
Summarized benefits
[project training] change of linear arrow
897. 递增顺序搜索树
C language learning summary
Xiaobai must see in investment and wealth management: illustrated fund buying and selling rules
Why can't the index of JS array use negative numbers
A small method of debugging equipment serial port information with ADB
【日常训练】513. 找树左下角的值
Solve the mining virus sshd2 (redis does not set a password and clear the crontab scheduled task)
[STL] summary of stack and queue usage of container adapter
About Supervision
直播回顾 | 传统应用进行容器化改造,如何既快又稳?
【项目实训10】箭头的绘制
MySQL重做日志 redo log
20220621 Dual Quaternion
316. 去除重复字母
深度学习系列47:超分模型Real-ESRGAN