GitHub - liuwd15/GAN-DP: A StyleGAN2-based method to create semantic IDPs. (original) (raw)

GAN-DP

A StyleGAN2-based method to create semantic image-derived phenotypes (IDPs).

Workflow

Prerequisite

This method uses the StyleGAN2 PyTorch implementation at (https://github.com/rosinality/stylegan2-pytorch). Please install it and refer to its usage before using the script in this repository.

Usage

Please run the following steps in turn:

Example

We provide sample intermediate result files (in folder sample) to demonstrate the last step to create semantic IDPs.

Folder sample/inversion_results contains the sample output results of the third step, inversion of target images.

File sample/factor.pt is the sample output result of the four step, closed-form factorization.

Then run:

python get_coordinate.py --factor sample/factor.pt --projection_dir sample/inversion_results

In the output file, the semantic IDPs are ordered by their relative importance (singular values). Select appropriate number of IDPs for GWAS by yourself!

Semantic IDPs

You can annotate IDPs by changing latent codes in each semantic direction. Here we show the results of fundus vasculature images.

IDP0

Contrast

IDP1

Upper/lower vessel length

IDP2

Left/right vessel length

IDP3

Vessel curvature

IDP4

Middle vessel

IDP5

Branches

References

StyleGAN2 [Paper][Github]

Closd-form factorization [Paper][Github]