mirror of
https://github.com/TencentARC/GFPGAN.git
synced 2025-06-01 07:00:22 -07:00
update README: update installation
This commit is contained in:
parent
1083f910dd
commit
cd37764741
50
README.md
50
README.md
@ -36,6 +36,7 @@ Blind face restoration usually relies on facial priors, such as facial geometry
|
|||||||
- Python >= 3.7 (Recommend to use [Anaconda](https://www.anaconda.com/download/#linux) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html))
|
- Python >= 3.7 (Recommend to use [Anaconda](https://www.anaconda.com/download/#linux) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html))
|
||||||
- [PyTorch >= 1.7](https://pytorch.org/)
|
- [PyTorch >= 1.7](https://pytorch.org/)
|
||||||
- NVIDIA GPU + [CUDA](https://developer.nvidia.com/cuda-downloads)
|
- NVIDIA GPU + [CUDA](https://developer.nvidia.com/cuda-downloads)
|
||||||
|
- Linux (We have not tested on Windows)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
@ -48,11 +49,33 @@ Blind face restoration usually relies on facial priors, such as facial geometry
|
|||||||
|
|
||||||
1. Install dependent packages
|
1. Install dependent packages
|
||||||
|
|
||||||
|
As StyleGAN2 uses customized PyTorch C++ extensions, you need to **compile them during installation** or **load then just-in-time(JIT)**.
|
||||||
|
You can refer to [BasicSR-INSTALL.md](https://github.com/xinntao/BasicSR/blob/master/INSTALL.md) for more details.
|
||||||
|
|
||||||
|
**Option 1: Load extensions just-in-time(JIT)** (For those just want to do simple inferences, may have less issues)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# remember to set BASICSR_JIT=True before your running commands
|
||||||
|
```
|
||||||
|
|
||||||
|
**Option 2: Compile extensions during installation** (For those need to train/inference for many times)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install basicsr - https://github.com/xinntao/BasicSR
|
# Install basicsr - https://github.com/xinntao/BasicSR
|
||||||
# We use BasicSR for both training and inference
|
# We use BasicSR for both training and inference
|
||||||
# Set BASICSR_EXT=True to compile the cuda extensions in the BasicSR - It may take several minutes to compile, please be patient
|
# Set BASICSR_EXT=True to compile the cuda extensions in the BasicSR - It may take several minutes to compile, please be patient
|
||||||
BASICSR_EXT=True pip install basicsr
|
# Add -vvv for detailed log prints
|
||||||
|
BASICSR_EXT=True pip install basicsr -vvv
|
||||||
|
|
||||||
# Install facexlib - https://github.com/xinntao/facexlib
|
# Install facexlib - https://github.com/xinntao/facexlib
|
||||||
# We use face detection and face restoration helper in the facexlib package
|
# We use face detection and face restoration helper in the facexlib package
|
||||||
@ -69,12 +92,23 @@ Download pre-trained models: [GFPGANv1.pth](https://github.com/TencentARC/GFPGAN
|
|||||||
wget https://github.com/TencentARC/GFPGAN/releases/download/v0.1.0/GFPGANv1.pth -P experiments/pretrained_models
|
wget https://github.com/TencentARC/GFPGAN/releases/download/v0.1.0/GFPGANv1.pth -P experiments/pretrained_models
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
- Option 1: Load extensions just-in-time(JIT)
|
||||||
python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/whole_imgs
|
|
||||||
|
|
||||||
# for aligned images
|
```bash
|
||||||
python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/cropped_faces --aligned
|
BASICSR_JIT=True python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/whole_imgs
|
||||||
```
|
|
||||||
|
# for aligned images
|
||||||
|
BASICSR_JIT=True python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/cropped_faces --aligned
|
||||||
|
```
|
||||||
|
|
||||||
|
- Option 2: Have successfully compiled extensions during installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/whole_imgs
|
||||||
|
|
||||||
|
# for aligned images
|
||||||
|
python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/cropped_faces --aligned
|
||||||
|
```
|
||||||
|
|
||||||
## :computer: Training
|
## :computer: Training
|
||||||
|
|
||||||
@ -94,6 +128,10 @@ You could improve it according to your own needs.
|
|||||||
|
|
||||||
> python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 train.py -opt train_gfpgan_v1.yml --launcher pytorch
|
> python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 train.py -opt train_gfpgan_v1.yml --launcher pytorch
|
||||||
|
|
||||||
|
or load extensions just-in-time(JIT)
|
||||||
|
|
||||||
|
> BASICSR_JIT=True python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 train.py -opt train_gfpgan_v1.yml --launcher pytorch
|
||||||
|
|
||||||
## :scroll: License and Acknowledgement
|
## :scroll: License and Acknowledgement
|
||||||
|
|
||||||
GFPGAN is realeased under Apache License Version 2.0.
|
GFPGAN is realeased under Apache License Version 2.0.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user