感謝您對我們的工作的興趣。您可能還想檢查我們在Real-Esrgan中有關動漫圖像和視頻的小型模型的新更新嗎?
GFPGAN旨在開發一種實用算法,用於現實世界的面部修復。
它利用封裝在經過驗證的面孔(例如stylegan2)中的豐富而多樣的先驗來進行盲人臉部修復。
❓常見問題可以在常見問題中找到。
更新
如果GFPGAN在您的照片/項目中有所幫助,請幫助此存儲庫或向您的朋友推薦。謝謝?其他推薦項目:
[紙] [項目頁] [演示]
Xintao Wang,Yu Li,Honglun Zhang,Ying Shan
應用研究中心(ARC),騰訊PCG
現在,我們提供了GFPGAN的乾淨版本,該版本不需要定制的CUDA擴展。
如果您想在我們的論文中使用原始型號,請參閱papermodel.md進行安裝。
克隆回購
git clone https://github.com/TencentARC/GFPGAN.git
cd GFPGAN安裝因軟件包
# Install basicsr - https://github.com/xinntao/BasicSR
# We use BasicSR for both training and inference
pip install basicsr
# Install facexlib - https://github.com/xinntao/facexlib
# We use face detection and face restoration helper in the facexlib package
pip install facexlib
pip install -r requirements.txt
python setup.py develop
# If you want to enhance the background (non-face) regions with Real-ESRGAN,
# you also need to install the realesrgan package
pip install realesrgan我們以v1.3版本為例。可以在這裡找到更多型號。
下載預訓練的模型:gfpganv1.3.pth
wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth -P experiments/pretrained_models推理!
python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2 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如果您想在我們的論文中使用原始型號,請參閱papermodel.md進行安裝和推理。
| 版本 | 模型名稱 | 描述 |
|---|---|---|
| v1.3 | gfpganv1.3.pth | 基於v1.2;更自然的恢復結果;在非常低質量 /高質量的輸入方面更好的結果。 |
| v1.2 | gfpgancleanv1-noce-c2.pth | 沒有著色;不需要CUDA擴展。接受了更多數據進行預處理培訓。 |
| V1 | gfpganv1.pth | 紙質模型,帶有著色。 |
比較是比較。
請注意,v1.3並不總是比v1.2好。您可能需要根據您的目的和輸入選擇不同的模型。
| 版本 | 優勢 | 弱點 |
|---|---|---|
| v1.3 | ✓自然產出 ✓非常低質量的輸入結果 ✓處理相對較高的輸入 ✓可以重複(兩次)修復 | ✗不是很清晰 ✗身份有輕微的改變 |
| v1.2 | ✓銳利的輸出 ✓帶有美容妝 | ✗有些輸出不自然 |
您可以在此處找到更多模型(例如歧視器) :[Google Drive]或[Tencent Cloud騰訊微雲]
我們提供GFPGAN的培訓代碼(在我們的論文中使用)。
您可以根據自己的需求改進它。
尖端
程式
(您可以嘗試一個簡單的版本( options/train_gfpgan_v1_simple.yml ),不需要面部分量地標。)
數據集準備:FFHQ
下載預訓練的模型和其他數據。將它們放入experiments/pretrained_models文件夾中。
相應地修改配置文件options/train_gfpgan_v1.yml 。
訓練
python -m torch.distributed.launch -nproc_per_node = 4 -master_port = 22021 gfpgan/train.py -opt options/train_gfpgan_v1.yml -launcher pytorch
GFPGAN由Apache許可證2.0版發布。
@InProceedings{wang2021gfpgan,
author = {Xintao Wang and Yu Li and Honglun Zhang and Ying Shan},
title = {Towards Real-World Blind Face Restoration with Generative Facial Prior},
booktitle={The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2021}
}
如果您有任何疑問,請發送電子郵件[email protected]或[email protected] 。