🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] > [github](https://github.com/sczhou/CodeFormer) ## 概述 - 把模糊照片变为清晰 - 把缺失的照片补充完整 ## 安装 **下载依赖** ``` # 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 conda install -c conda-forge dlib (only for face detection or cropping with dlib) ``` **下载预处理模型** 载facelib和dlib预训练模型[感觉这个并非必须] ``` python scripts/download_pretrained_models.py facelib ``` 下载CodeFormer 预训练模型 ``` python scripts/download_pretrained_models.py CodeFormer ``` ## 示例 ### 面部修复(裁剪并对齐面部) ``` python inference_codeformer.py -w 0.5 --has_aligned --input_path [image folder]|[image path] ``` ### 整体图像增强 ``` python inference_codeformer.py -w 0.7 --input_path [image folder]|[image path] ``` ### 视频增强 ``` conda install -c conda-forge ffmpeg python inference_codeformer.py --bg_upsampler realesrgan --face_upsample -w 1.0 --input_path [video path] ``` ### 脸部着色(裁剪并对齐脸部) ``` python inference_colorization.py --input_path [image folder]|[image path] ``` ### 🎨 脸部修复(裁剪并对齐脸部) ``` python inference_inpainting.py --input_path [image folder]|[image path] ```