{"id":19768575,"url":"https://github.com/prinsphield/genegan","last_synced_at":"2025-08-30T09:08:37.219Z","repository":{"id":141901327,"uuid":"90262569","full_name":"Prinsphield/GeneGAN","owner":"Prinsphield","description":"GeneGAN: Learning Object Transfiguration and Attribute Subspace from Unpaired Data","archived":false,"fork":false,"pushed_at":"2018-04-26T08:13:26.000Z","size":864,"stargazers_count":143,"open_issues_count":2,"forks_count":34,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-30T17:44:30.882Z","etag":null,"topics":["attributes-subspace","celeba-dataset","generative-adversarial-network","image-interpolation","image-manipulation"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/1705.04932v1","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Prinsphield.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-05-04T12:50:51.000Z","updated_at":"2025-01-23T06:08:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"a0a4380e-558c-4c58-b25e-d2b97ac09c5f","html_url":"https://github.com/Prinsphield/GeneGAN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Prinsphield/GeneGAN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prinsphield%2FGeneGAN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prinsphield%2FGeneGAN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prinsphield%2FGeneGAN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prinsphield%2FGeneGAN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Prinsphield","download_url":"https://codeload.github.com/Prinsphield/GeneGAN/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prinsphield%2FGeneGAN/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272827624,"owners_count":24999847,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["attributes-subspace","celeba-dataset","generative-adversarial-network","image-interpolation","image-manipulation"],"created_at":"2024-11-12T04:39:14.355Z","updated_at":"2025-08-30T09:08:37.178Z","avatar_url":"https://github.com/Prinsphield.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GeneGAN: Learning Object Transfiguration and Attribute Subspace from Unpaired Data\n\nBy Shuchang Zhou, Taihong Xiao, Yi Yang, Dieqiao Feng, Qinyao He, Weiran He\n\nIf you use this code for your research, please cite our paper:\n```\n@inproceedings{DBLP:conf/bmvc/ZhouXYFHH17,\n  author    = {Shuchang Zhou and\n               Taihong Xiao and\n               Yi Yang and\n               Dieqiao Feng and\n               Qinyao He and\n               Weiran He},\n  title     = {GeneGAN: Learning Object Transfiguration and Attribute Subspace from Unpaired Data},\n  booktitle = {Proceedings of the British Machine Vision Conference (BMVC)},\n  year      = {2017},\n  url       = {http://arxiv.org/abs/1705.04932},\n  timestamp = {http://dblp.uni-trier.de/rec/bib/journals/corr/ZhouXYFHH17},\n  bibsource = {dblp computer science bibliography, http://dblp.org}\n}\n```\n\nWe have two following papers, [DNA-GAN](https://github.com/Prinsphield/DNA-GAN) and [ELEGANT](https://github.com/Prinsphield/ELEGANT), that generalize the method into multiple attributes case. It is worth mentioning that [ELEGANT](https://github.com/Prinsphield/ELEGANT) can transfer multiple face attributes on high resolution images. Please pay attention to our new methods!\n\n### Introduction\n\nThis is the official source code for the paper [GeneGAN: Learning Object Transfiguration \nand Attribute Subspace from Unpaired Data](https://arxiv.org/abs/1705.04932v1). All the experiments are initially done in \nour proprietary deep learning framework. For convenience, we reproduce the results using TensorFlow.\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg align=\"center\" src=\"images/cross.jpg\" width=\"450\" alt=\"cross\"\u003e\n\u003c/div\u003e \n\u003cbr/\u003e\n\nGeneGAN is a deterministic conditional generative model that can learn to disentangle the object\nfeatures from other factors in feature space from weak supervised 0/1 labeling of training data.\nIt allows fine-grained control of generated images on one certain attribute in a continous way.\n\n\n### Requirement\n\n- Python 3.5\n- TensorFlow 1.0\n- Opencv 3.2\n\n\n### Training GeneGAN on celebA dataset\n\n0. Download [celebA](http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html) dataset and unzip it into\n`datasets` directory. There are various source providers for CelebA datasets. To ensure that the\nsize of downloaded images is correct, please run `identify datasets/celebA/data/000001.jpg`. The\nsize should be 409 x 687 if you are using the same dataset. Besides, please ensure that you have\nthe following directory tree structure.\n\n```\n├── datasets\n│   └── celebA\n│       ├── data\n│       ├── list_attr_celeba.txt\n│       └── list_landmarks_celeba.txt\n```\n\n1. Run `python preprocess.py`. It will take several miniutes to preprocess all face images.\nA new directory `datasets/celebA/align_5p` will be created.\n\n2. Run `python train.py -a Bangs -g 0` to train GeneGAN on the attribute `Bangs`. \nYou can train GeneGAN on other attributes as well. All available attribute names are\nlisted in the `list_attr_celeba.txt` file. \n\n3. Run `tensorboard --logdir='./' --port 6006` to watch your training process.\n\n\n### Testing\n\nWe provide three kinds of mode for test. Run `python test.py -h` for detailed help.\nThe following example is running on our GeneGAN model trained on the attribute\n`Bangs`. Have fun!\n\n#### 1. Swapping of Attributes \n\nYou can easily add the bangs of one person to another person without bangs by running \n\n    python test.py -m swap -i datasets/celebA/align_5p/182929.jpg -t datasets/celebA/align_5p/022344.jpg\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg align=\"center\" src=\"images/182929_resize.jpg\" alt=\"input\"\u003e\n\u003cimg align=\"center\" src=\"images/022344_resize.jpg\" alt=\"target\"\u003e\n\n\u003cimg align=\"center\" src=\"images/swap_out1.jpg\" alt=\"out1\"\u003e\n\u003cimg align=\"center\" src=\"images/swap_out2.jpg\" alt=\"out2\"\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\nSwap Attribute\n\u003c/div\u003e\n\u003cbr/\u003e\n\n\n#### 2. Linear Interpolation of Image Attributes\n\nBesides, we can control to which extent the bangs style is added to your input image\nthrough linear interpolation of image attribute. Run the following code.\n\n    python test.py -m interpolation -i datasets/celebA/align_5p/182929.jpg -t datasets/celebA/align_5p/035460.jpg -n 5\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg align=\"center\" src=\"images/interpolation.jpg\" alt=\"interpolation\"\u003e\n\u003cimg align=\"center\" src=\"images/035460_resize.jpg\" alt=\"target\"\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\nLinear Interpolation\n\u003c/div\u003e\n\u003cbr/\u003e\n\n#### 3. Matrix Interpolation in Attribute Subspace\n\nWe can do something cooler. Given four images with bangs attributes at hand,\nwe can observe the gradual change process of our input images with a mixing of\ndifference bangs style.\n\n    python test.py -m matrix -i datasets/celebA/align_5p/182929.jpg --targets datasets/celebA/align_5p/035460.jpg datasets/celebA/align_5p/035451.jpg datasets/celebA/align_5p/035463.jpg datasets/celebA/align_5p/035474.jpg -s 5 5\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg align=\"center\" src=\"images/four_matrix.jpg\" alt=\"matrix\"\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\nMatrix Interpolation\n\u003c/div\u003e\n\u003cbr/\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprinsphield%2Fgenegan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprinsphield%2Fgenegan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprinsphield%2Fgenegan/lists"}