metroidmen commited on
Commit
440a2a9
1 Parent(s): 5ecc1dc

Upload PaperModel.md

Browse files
Files changed (1) hide show
  1. PaperModel.md +76 -0
PaperModel.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installation
2
+
3
+ We now provide a *clean* version of GFPGAN, which does not require customized CUDA extensions. See [here](README.md#installation) for this easier installation.<br>
4
+ If you want want to use the original model in our paper, please follow the instructions below.
5
+
6
+ 1. Clone repo
7
+
8
+ ```bash
9
+ git clone https://github.com/xinntao/GFPGAN.git
10
+ cd GFPGAN
11
+ ```
12
+
13
+ 1. Install dependent packages
14
+
15
+ As StyleGAN2 uses customized PyTorch C++ extensions, you need to **compile them during installation** or **load them just-in-time(JIT)**.
16
+ You can refer to [BasicSR-INSTALL.md](https://github.com/xinntao/BasicSR/blob/master/INSTALL.md) for more details.
17
+
18
+ **Option 1: Load extensions just-in-time(JIT)** (For those just want to do simple inferences, may have less issues)
19
+
20
+ ```bash
21
+ # Install basicsr - https://github.com/xinntao/BasicSR
22
+ # We use BasicSR for both training and inference
23
+ pip install basicsr
24
+
25
+ # Install facexlib - https://github.com/xinntao/facexlib
26
+ # We use face detection and face restoration helper in the facexlib package
27
+ pip install facexlib
28
+
29
+ pip install -r requirements.txt
30
+ python setup.py develop
31
+
32
+ # remember to set BASICSR_JIT=True before your running commands
33
+ ```
34
+
35
+ **Option 2: Compile extensions during installation** (For those need to train/inference for many times)
36
+
37
+ ```bash
38
+ # Install basicsr - https://github.com/xinntao/BasicSR
39
+ # We use BasicSR for both training and inference
40
+ # Set BASICSR_EXT=True to compile the cuda extensions in the BasicSR - It may take several minutes to compile, please be patient
41
+ # Add -vvv for detailed log prints
42
+ BASICSR_EXT=True pip install basicsr -vvv
43
+
44
+ # Install facexlib - https://github.com/xinntao/facexlib
45
+ # We use face detection and face restoration helper in the facexlib package
46
+ pip install facexlib
47
+
48
+ pip install -r requirements.txt
49
+ python setup.py develop
50
+ ```
51
+
52
+ ## :zap: Quick Inference
53
+
54
+ Download pre-trained models: [GFPGANv1.pth](https://github.com/TencentARC/GFPGAN/releases/download/v0.1.0/GFPGANv1.pth)
55
+
56
+ ```bash
57
+ wget https://github.com/TencentARC/GFPGAN/releases/download/v0.1.0/GFPGANv1.pth -P experiments/pretrained_models
58
+ ```
59
+
60
+ - Option 1: Load extensions just-in-time(JIT)
61
+
62
+ ```bash
63
+ BASICSR_JIT=True python inference_gfpgan.py --input inputs/whole_imgs --output results --version 1
64
+
65
+ # for aligned images
66
+ BASICSR_JIT=True python inference_gfpgan.py --input inputs/whole_imgs --output results --version 1 --aligned
67
+ ```
68
+
69
+ - Option 2: Have successfully compiled extensions during installation
70
+
71
+ ```bash
72
+ python inference_gfpgan.py --input inputs/whole_imgs --output results --version 1
73
+
74
+ # for aligned images
75
+ python inference_gfpgan.py --input inputs/whole_imgs --output results --version 1 --aligned
76
+ ```