{"id":13784798,"url":"https://rameenabdal.github.io/StyleFlow/","last_synced_at":"2025-05-11T20:31:20.790Z","repository":{"id":37218712,"uuid":"267200032","full_name":"RameenAbdal/StyleFlow","owner":"RameenAbdal","description":"StyleFlow: Attribute-conditioned Exploration of StyleGAN-generated Images using  Conditional Continuous Normalizing Flows (ACM TOG 2021)","archived":false,"fork":false,"pushed_at":"2023-03-24T22:20:54.000Z","size":99512,"stargazers_count":2454,"open_issues_count":80,"forks_count":342,"subscribers_count":78,"default_branch":"master","last_synced_at":"2025-05-07T22:02:11.827Z","etag":null,"topics":["faces","quality","sequential-edits","stylegan"],"latest_commit_sha":null,"homepage":"http://rameenabdal.github.io/StyleFlow","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RameenAbdal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-05-27T02:20:54.000Z","updated_at":"2025-05-05T21:52:47.000Z","dependencies_parsed_at":"2023-02-17T15:46:23.736Z","dependency_job_id":null,"html_url":"https://github.com/RameenAbdal/StyleFlow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RameenAbdal%2FStyleFlow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RameenAbdal%2FStyleFlow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RameenAbdal%2FStyleFlow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RameenAbdal%2FStyleFlow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RameenAbdal","download_url":"https://codeload.github.com/RameenAbdal/StyleFlow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253631956,"owners_count":21939368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["faces","quality","sequential-edits","stylegan"],"created_at":"2024-08-03T19:00:52.658Z","updated_at":"2025-05-11T20:31:15.767Z","avatar_url":"https://github.com/RameenAbdal.png","language":"Python","funding_links":[],"categories":["🧑‍💻 Repos \u003csmall\u003e(18)\u003c/small\u003e"],"sub_categories":["\u003cimg src=\"assets/pytorch.svg\" alt=\"PyTorch\" height=\"20px\"\u003e \u0026nbsp;PyTorch Repos"],"readme":"# StyleFlow: Attribute-conditioned Exploration of StyleGAN-Generated Images using Conditional Continuous Normalizing Flows (ACM TOG 2021)\n## See you @ Siggraph 2021\n![Python 3.7](https://img.shields.io/badge/Python-3.7-green.svg?style=plastic)\n![pytorch 1.1.0](https://img.shields.io/badge/Pytorch-1.1.0-green.svg?style=plastic)\n![TensorFlow 1.15.0](https://img.shields.io/badge/TensorFlow-1.15.0-green.svg?style=plastic)\n![Torchdiffeq 0.0.1](https://img.shields.io/badge/Torchdiffeq-0.0.1-green.svg?style=plastic)\n![pyqt5 5.13.0](https://img.shields.io/badge/pyqt5-5.13.0-green.svg?style=plastic)\n\n![image](./docs/assets/teaser.png)\n**Figure:** *Sequential edits using StyleFlow*\n\nHigh-quality, diverse, and photorealistic images can now be generated by unconditional GANs (e.g., StyleGAN). However, limited options exist to control the generation process using (semantic) attributes, while still preserving the quality of the output. Further, due to the entangled nature of the GAN latent space, performing edits along one attribute can easily result in unwanted changes along other attributes. In this paper, in the context of conditional exploration of entangled latent spaces, we investigate the two sub-problems of attribute-conditioned sampling and attribute-controlled editing. We present StyleFlow as a simple, effective, and robust solution to both the sub-problems by formulating conditional exploration as an instance of conditional continuous normalizing flows in the GAN latent space conditioned by attribute features. We evaluate our method using the face and the car latent space of StyleGAN, and demonstrate fine-grained disentangled edits along various attributes on both real photographs and StyleGAN generated images. For example, for faces, we vary camera pose, illumination variation, expression, facial hair, gender, and age. Finally, via extensive qualitative and quantitative comparisons, we demonstrate the superiority of StyleFlow to other concurrent works.\n\n\u003e **StyleFlow: Attribute-conditioned Exploration of StyleGAN-Generated Images using Conditional Continuous Normalizing Flows (ACM TOG 2021)** \u003cbr\u003e\n\u003e  Rameen Abdal, Peihao Zhu, Niloy Mitra, Peter Wonka \u003cbr\u003e\n\u003e  KAUST, Adobe Research \u003cbr\u003e\n\n\n\n[[Paper](https://dl.acm.org/doi/10.1145/3447648)]\n[[Project Page](https://rameenabdal.github.io/StyleFlow/)]\n[[Demo](https://youtu.be/LRAUJUn3EqQ)]\n[[Promotional Video](https://youtu.be/Lt4Z5oOAeEY)]\n\n\n## Installation\n\nClone this repo.\n```bash\ngit clone https://github.com/RameenAbdal/StyleFlow.git\ncd StyleFlow/\n```\n\nThis code requires PyTorch, TensorFlow, Torchdiffeq, Python 3+ and Pyqt5. Please install dependencies by\n```bash\nconda env create -f environment.yml\n```\n\nStyleGAN2 relies on custom TensorFlow ops that are compiled on the fly using [NVCC](https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html). To correctly setup the StyleGAN2 generator follow the **Requirements** in [this repo](https://github.com/NVlabs/stylegan2).\n\n## Installation (Docker)\n\nClone this repo.\n\n```bash\ngit clone https://github.com/RameenAbdal/StyleFlow.git\ncd StyleFlow/\n```\n\nYou must have CUDA (\u003e=10.0 \u0026\u0026 \u003c11.0) and [nvidia-docker2](https://github.com/NVIDIA/nvidia-docker) installed first !\n\nThen, run :\n\n```bash\nxhost +local:docker # Letting Docker access X server\nwget -P stylegan/ http://d36zk2xti64re0.cloudfront.net/stylegan2/networks/stylegan2-ffhq-config-f.pkl\ndocker-compose up --build # Expect some time before UI appears\n```\n\nWhen finished, run :\n\n```bash\nxhost -local:docker\n```\n\n## UI Illustration\n\n\u003cimg src=\"./docs/assets/main.gif\" alt=\"main\"  width=400\u003e \u003cimg src=\"./docs/assets/attribute.gif\" alt=\"main\"  width=400\u003e\n\n\n**Loading images may take 2 - 3 seconds on the first click. Move the slider smoothly to render results.**\n\n\n\n\n## Editing Images Using Pretrained Models\n\n\n1.  Run the main UI\n\n    ``` bash\n\tpython main.py\n    ```\n\n2. Run the Attribute Transfer UI\n\t```bash\n   python main_attribute.py \n    ```\n\n## Web UI (Beta)\nA web based UI is also now available. Follow [webui](https://github.com/RameenAbdal/StyleFlow/tree/webui) dev branch for setup.\n\n![image](./docs/assets/styleflow-web-final.gif)\n\n## Training New Model\nDataset containing sampled StyleGAN2 latents, lighting SH parameters and other attributes. ([Download Here](https://drive.google.com/file/d/1opdzeqpYWtE1uexO49JI-3_RWfE9MYlN/view?usp=sharing))\n\nCreate `./data_numpy/` in the main folder and extract the above data or create your own dataset.\n\nTrain your model:\n```bash\n   python train_flow.py \n```\n## Projection\n\nOur new projection method is currently under review. To be updated!\nFollow the repo for updates : https://github.com/ZPdesu/II2S\n\n## License\n\nAll rights reserved. Licensed under the [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode) (**Attribution-NonCommercial-ShareAlike 4.0 International**). The code is released for academic research use only.\n\n## Citation\nIf you use this research/codebase/dataset, please cite our papers.\n```\n@article{10.1145/3447648,\nauthor = {Abdal, Rameen and Zhu, Peihao and Mitra, Niloy J. and Wonka, Peter},\ntitle = {StyleFlow: Attribute-Conditioned Exploration of StyleGAN-Generated Images Using Conditional Continuous Normalizing Flows},\nyear = {2021},\nissue_date = {May 2021},\npublisher = {Association for Computing Machinery},\naddress = {New York, NY, USA},\nvolume = {40},\nnumber = {3},\nissn = {0730-0301},\nurl = {https://doi.org/10.1145/3447648},\ndoi = {10.1145/3447648},\nabstract = {High-quality, diverse, and photorealistic images can now be generated by unconditional GANs (e.g., StyleGAN). However, limited options exist to control the generation process using (semantic) attributes while stillpreserving the quality of the output. Further, due to the entangled nature of the GAN latent space, performing edits along one attribute can easily result in unwanted changes along other attributes. In this article, in the context of conditional exploration of entangled latent spaces, we investigate the two sub-problems of attribute-conditioned sampling and attribute-controlled editing. We present StyleFlow as a simple, effective, and robust solution to both the sub-problems by formulating conditional exploration as an instance of conditional continuous normalizing flows in the GAN latent space conditioned by attribute features. We evaluate our method using the face and the car latent space of StyleGAN, and demonstrate fine-grained disentangled edits along various attributes on both real photographs and StyleGAN generated images. For example, for faces, we vary camera pose, illumination variation, expression, facial hair, gender, and age. Finally, via extensive qualitative and quantitative comparisons, we demonstrate the superiority of StyleFlow over prior and several concurrent works. Project Page and Video: https://rameenabdal.github.io/StyleFlow.},\njournal = {ACM Trans. Graph.},\nmonth = may,\narticleno = {21},\nnumpages = {21},\nkeywords = {image editing, Generative adversarial networks}\n}\n```\n```\n@INPROCEEDINGS{9008515,\n  author={Abdal, Rameen and Qin, Yipeng and Wonka, Peter},\n  booktitle={2019 IEEE/CVF International Conference on Computer Vision (ICCV)}, \n  title={Image2StyleGAN: How to Embed Images Into the StyleGAN Latent Space?}, \n  year={2019},\n  volume={},\n  number={},\n  pages={4431-4440},\n  doi={10.1109/ICCV.2019.00453}}\n```\n\n## Broader Impact\n*Important* : Deep learning based facial imagery like DeepFakes and GAN generated images can be gravely misused. This can spread misinformation and lead to other offences. The intent of our work is not to promote such practices but instead be used in the areas such as identification (novel views of a subject, occlusion inpainting etc. ), security (facial composites etc.), image compression (high quality video conferencing at lower bitrates etc.) and development of algorithms for detecting DeepFakes.\n\n## Acknowledgments\nThis implementation builds upon the awesome work done by Karras et al. ([StyleGAN2](https://github.com/NVlabs/stylegan2)), Chen et al. ([torchdiffeq](https://github.com/rtqichen/torchdiffeq)) and Yang et al. ([PointFlow](https://arxiv.org/abs/1906.12320)). This work was supported by Adobe Research and KAUST Office of Sponsored Research (OSR).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/rameenabdal.github.io%2FStyleFlow%2F","html_url":"https://awesome.ecosyste.ms/projects/rameenabdal.github.io%2FStyleFlow%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/rameenabdal.github.io%2FStyleFlow%2F/lists"}