Skip to content

Commit 609911b

Browse files
committed
Updated README.md
1 parent 3f1ea7f commit 609911b

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

‎README.md‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,38 @@ For example, if you cloned repositories in ~/stylegan2 and downloaded stylegan2-
3535

3636
> python convert_weight.py --repo ~/stylegan2 stylegan2-ffhq-config-f.pkl
3737
38-
This will create converted stylegan2-ffhq-config-f.pt file.
38+
This will create converted stylegan2-ffhq-config-f.pt file.
3939

4040
### Generate samples
4141

42-
> python generate.py --sample N_FACES --pics N_PICS --ckpt PATH_CHECKPOINT
42+
> python generate.py --sample N_FACES --pics N_PICS --ckpt PATH_CHECKPOINT
4343
44-
You should change your size (--size 256 for example) if you train with another dimension.
44+
You should change your size (--size 256 for example) if you train with another dimension.
4545

4646
### Project images to latent spaces
4747

4848
> python projector.py --ckpt [CHECKPOINT] --size [GENERATOR_OUTPUT_SIZE] FILE1 FILE2 ...
4949
50+
### Closed-Form Factorization (https://arxiv.org/abs/2007.06600)
51+
52+
You can use `closed_form_factorization.py` and `apply_factor.py` to discover meaningful latent semantic factor or directions in unsupervised manner.
53+
54+
First, you need to extract eigenvectors of weight matrices using `closed_form_factorization.py`
55+
56+
> python closed_form_factorization.py [CHECKPOINT]
57+
58+
This will create factor file that contains eigenvectors. (Default: factor.pt) And you can use `apply_factor.py` to test the meaning of extracted directions
59+
60+
> python apply_factor.py -i [INDEX_OF_EIGENVECTOR] -d [DEGREE_OF_MOVE] -n [NUMBER_OF_SAMPLES] --ckpt [CHECKPOINT] [FACTOR_FILE]
61+
62+
For example,
63+
64+
> python apply_factor.py -i 19 -d 5 -n 10 --ckpt [CHECKPOINT] factor.pt
65+
66+
Will generate 10 random samples, and samples generated from latents that moved along 19th eigenvector with size/degree +-5.
67+
68+
![Sample of closed form factorization](factor_index-13_degree-5.0.png)
69+
5070
## Pretrained Checkpoints
5171

5272
[Link](https://drive.google.com/open?id=1PQutd-JboOCOZqmd95XWxWrO8gGEvRcO)

0 commit comments

Comments
 (0)