🚀 私たちの仕事に関心をお寄せいただきありがとうございます。また、Real-ESRGAN😊 のアニメ画像とビデオの小さなモデルに関する新しいアップデートを確認することもできます
GFPGANは、実世界の顔復元のための実用的なアルゴリズムの開発を目指しています。
事前にトレーニングされた顔のGAN(StyleGAN2など)にカプセル化された豊富で多様な事前確率を活用して、ブラインドフェイスの修復を行います。
GFPGANが写真/プロジェクトに役立つ場合は、このリポジトリを支援する
[論文][プロジェクトページ][デモ]
王 新濤, 李 玉, 張 宏倫, 英山
応用研究センター (ARC), テンセントPCG
カスタマイズされたCUDA拡張機能を必要としないGFPGANのクリーンバージョンを提供するようになりました。
本稿のオリジナルモデルを使用する場合は、インストール 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 を参照してください。
バージョン | モデル名 | 形容 |
---|---|---|
バージョン1.3 | GFPGANv1.3.pth | v1.2に基づいています。より自然な修復結果。非常に低品質/高品質の入力でより良い結果。 |
バージョン1.2 | GFPGANCleanv1-NoCE-C2.pth | 着色なし。CUDA拡張機能は必要ありません。前処理でより多くのデータでトレーニングされます。 |
V1 | GFPGANv1.pth | カラー化を施した紙のモデル。 |
比較は Comparisons.md です。
V1.3 が V1.2 よりも優れているとは限らないことに注意してください。目的と入力に基づいて異なるモデルを選択する必要がある場合があります。
バージョン | 強み | 弱点 |
---|---|---|
バージョン1.3 | ✓自然な出力 ✓非常に低品質の入力でより良い結果 ✓比較的高品質の入力 で作業する ✓ 繰り返し(2回)復元することができます |
✗あまりシャープ ではない✗アイデンティティにわずかな変化がある |
バージョン1.2 | ✓よりシャープな出力 ✓美容メイク付き |
✗一部の出力が不自然です |
あなたはここでより多くのモデル(差別器など)を見つけることができます: [Googleドライブ]、または[テンセントクラウド腾讯微云]
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} }
ご不明な点がございましたら、メールまたは .
xintao.wang@outlook.com
xintaowang@tencent.com