Windows 10
Install python
- Open the official Python website in your web browser. Navigate to the Downloads tab for Windows.
- Add Python to environmental variables.
- Verify the Python Installation.
> python
Install Git
Open the official Git website in your web browser. Navigate to the Downloads tab for Windows.
Install Conda
- Open the official anaconda website in your web browser. Navigate to the Downloads tab for Windows.
- In the Environment Variables window, Add or modify the path lines with the paths you want the computer to access.
D:\ProgramData\Anaconda3\Scripts\
D:\ProgramData\Anaconda3\Library\bin
- After creating or modifying the environment variables, restart the computer for those changes to take effect in Windows.
Install PyTorch
Open the official PyTorch website in your web browser. Navigate to the Install tab.
Install DUDA
> nvcc --version
Install CodeFormer
Open the CodeFormer in your web browser.
> git clone https://github.com/sczhou/CodeFormer
> cd CodeFormer
> pip install -r requirements.txt -q
> pip install -q gradio
> python basicsr/setup.py develop
> python scripts/download_pretrained_models.py facelib
> python scripts/download_pretrained_models.py CodeFormer
Testing on Face Restoration
🧑🏻 Face Restoration (cropped and aligned face)
# For cropped and aligned faces
python inference_codeformer.py -w 0.5 --has_aligned --input_path [input folder]
🖼️ Whole Image Enhancement
# 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]
🎬 Video Enhancement
# For video clips
python inference_codeformer.py --bg_upsampler realesrgan --face_upsample -w 1.0 --input_path [video path]
Fidelity weight w lays in [0, 1]. Generally, smaller w tends to produce a higher-quality result, while larger w yields a higher-fidelity result.
The results will be saved in the results folder.
Notes
> pip uninstall ffmpeg-python
> pip uninstall ffmpeg
> conda install -c menpo ffmpeg
> pip install ffmpeg-python