シャンチェン・ジョウ、ケルビン・C・K・チャン、チョンイー・リー、チェン・チェンジ・ロイ
南洋理工大学S-Lab
[ニュース]:
--input_path [YOUR_VIDOE.mp4]
--face_upsample
['RetinaFace'(default), 'YOLOv5']
requirements.txt
# git clone this repository git clone https://github.com/sczhou/CodeFormer cd CodeFormer # create new anaconda env conda create -n codeformer python=3.8 -y conda activate codeformer # install python dependencies pip3 install -r requirements.txt python basicsr/setup.py develop
[Googleドライブ|からfacelib事前トレーニング済みモデルをダウンロードしますOneDrive]をフォルダに追加します。事前トレーニング済みモデルを手動でダウンロードするか、次のコマンドを実行してダウンロードできます。
weights/facelib
python scripts/download_pretrained_models.py facelib
CodeFormerの事前トレーニング済みモデルを[Googleドライブ|からダウンロードするOneDrive]をフォルダに追加します。事前トレーニング済みモデルを手動でダウンロードするか、次のコマンドを実行してダウンロードできます。
weights/CodeFormer
python scripts/download_pretrained_models.py CodeFormer
テスト イメージをフォルダーに配置できます。トリミングおよび整列した面でテストする場合は、それらをフォルダーに入れることができます。
inputs/TestWhole
inputs/cropped_faces
[参考]論文でCodeFormerを比較する場合は、画像全体のコマンドに顔と背景の融合プロセスが含まれ、境界の髪の質感が損なわれる可能性があり、不公平な比較につながる可能性があるため、(トリミングおよび整列した顔の場合)ことを示す次のコマンドを実行してください。
--has_aligned
🧑🏻 顔の修復(トリミングおよび整列した顔)
# For cropped and aligned faces python inference_codeformer.py -w 0.5 --has_aligned --input_path [input folder]
# For whole image # Add '--bg_upsampler realesrgan' to enhance the background regions with Real-ESRGAN # Add '--face_upsample' to further upsample restorated face with Real-ESRGAN python inference_codeformer.py -w 0.7 --input_path [image folder/image path]
# For video clips # Set frame rate of saved video via '--save_video_fps 24' python inference_codeformer.py --bg_upsampler realesrgan --face_upsample -w 1.0 --input_path [video path] --save_video_fps 24
忠実度の重み w は [0, 1] にあります。一般に、w を小さくすると高品質の結果が得られる傾向があり、w を大きくすると忠実度の高い結果が得られます。
結果はフォルダに保存されます。
results
私たちの研究があなたの研究に役立つ場合は、以下を引用することを検討してください。
@inproceedings{zhou2022codeformer, author = {Zhou, Shangchen and Chan, Kelvin C.K. and Li, Chongyi and Loy, Chen Change}, title = {Towards Robust Blind Face Restoration with Codebook Lookup TransFormer}, booktitle = {NeurIPS}, year = {2022} }
このプロジェクトは、NTU S-Labライセンス1.0の下でライセンスされています。再配布と使用は、このライセンスに従う必要があります。
このプロジェクトはBasicSRに基づいています。一部のコードは、Unleashing Transformers、YOLOv5-face、およびFaceXLibから持ち込まれます。また、背景画像の強調をサポートするためにリアルESRGANを採用しています。彼らの素晴らしい作品をありがとう。
ご不明な点がございましたら、お気軽にお問い合わせください。
shangchenzhou@gmail.com