{"id":17166355,"url":"https://github.com/andreaferretti/wgan","last_synced_at":"2025-03-24T17:44:27.493Z","repository":{"id":66316553,"uuid":"203762526","full_name":"andreaferretti/wgan","owner":"andreaferretti","description":"Wasserstein GAN with Gradient Penalty","archived":false,"fork":false,"pushed_at":"2019-09-09T14:38:09.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T22:31:37.708Z","etag":null,"topics":["gan","pytorch","wasserstein-gan"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreaferretti.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-22T09:37:00.000Z","updated_at":"2021-01-21T10:55:19.000Z","dependencies_parsed_at":"2023-05-12T07:30:54.611Z","dependency_job_id":null,"html_url":"https://github.com/andreaferretti/wgan","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"375a1d0e5eb368acb79014a394adec7280b2c346"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaferretti%2Fwgan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaferretti%2Fwgan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaferretti%2Fwgan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaferretti%2Fwgan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreaferretti","download_url":"https://codeload.github.com/andreaferretti/wgan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245320142,"owners_count":20596115,"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":["gan","pytorch","wasserstein-gan"],"created_at":"2024-10-14T23:05:22.640Z","updated_at":"2025-03-24T17:44:27.473Z","avatar_url":"https://github.com/andreaferretti.png","language":"Python","readme":"# Wasserstein GAN with Gradient Penalty in Pytorch\n\nThis is a cleanup of [improved-wgan-pytorch](https://github.com/jalola/improved-wgan-pytorch),\nwhich implements methods from [Improved Training of Wasserstein GANs](https://github.com/igul222/improved_wgan_training)\nto train Wasserstein GAN with Gradient Penalty.\n\n## Prerequisites\n\nThis project uses PyTorch (any recent version will do, we are using 1.2),\nand [LMDB](https://lmdb.readthedocs.io/en/release/) (the latter is needed to\nload data in [LSUN](https://github.com/fyu/lsun) format).\n\nOptionally, it can log events using [tensorboardX](https://github.com/lanpa/tensorboardX)\nthat can be displayed using [TensorBoard](https://www.tensorflow.org/tensorboard).\n\nFor instance, you can create an [Anaconda](https://anaconda.org) environment\nto run this project using something like\n\n```\nconda create -n wgan python=3.6\nsource activate wgan\nconda install pytorch torchvision cudatoolkit=9.0 -c pytorch\npip install lmdb\npip install tensorboardX # optional\n```\n\n## Usage\n\nIf you have a folder of images, structured like this\n\n```\n.\n└── images\n    ├── class1\n    │   ├── img001.png\n    │   ├── img002.png\n    │   └── ...\n    ├── class2\n    │   └── ...\n    └── ...\n```\n\nuse `--dataset raw --data-dir images`, while for the LSUN dataset\n\n```\n.\n└── LSUN\n    ├── bedroom_train_lmdb\n    │   ├── data.mdb\n    │   └── lock.mdb\n    ├── bedroom_val_lmdb\n    │   ├── data.mdb\n    │   └── lock.mdb\n    ├── bridge_train_lmdb\n    │   ├── data.mdb\n    │   └── lock.mdb\n    ├── bridge_val_lmdb\n    │   ├── data.mdb\n    │   └── lock.mdb\n    └── ...\n```\n\nuse something like `--dataset lsun --data-dir LSUN --image-class bedroom`.\n\nAll options are described in the help below\n\n```\nusage: train.py [-h] --data-dir DATA_DIR --output-dir OUTPUT_DIR --model-dir\n                MODEL_DIR [--image-class IMAGE_CLASS] [--dataset {raw,lsun}]\n                [--restore] [--image-size IMAGE_SIZE]\n                [--state-size STATE_SIZE] [--batch-size BATCH_SIZE]\n                [--epochs EPOCHS]\n                [--generator-iterations GENERATOR_ITERATIONS]\n                [--critic-iterations CRITIC_ITERATIONS]\n                [--sample-every SAMPLE_EVERY]\n                [--gradient-penalty GRADIENT_PENALTY]\n                [--generator-lr GENERATOR_LR] [--critic-lr CRITIC_LR]\n\nWasserstein GAN\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --data-dir DATA_DIR   directory with the images\n  --output-dir OUTPUT_DIR\n                        directory where to store the generated images\n  --model-dir MODEL_DIR\n                        directory where to store the models\n  --image-class IMAGE_CLASS\n                        class to train on, only for LSUN\n  --dataset {raw,lsun}  format of the dataset\n  --restore             restart training from the saved models\n  --image-size IMAGE_SIZE\n                        image dimension\n  --state-size STATE_SIZE\n                        state size\n  --batch-size BATCH_SIZE\n                        batch size\n  --epochs EPOCHS       number of epochs\n  --generator-iterations GENERATOR_ITERATIONS\n                        number of iterations for the generator\n  --critic-iterations CRITIC_ITERATIONS\n                        number of iterations for the critic\n  --sample-every SAMPLE_EVERY\n                        how often to sample images\n  --gradient-penalty GRADIENT_PENALTY\n                        gradient penalty\n  --generator-lr GENERATOR_LR\n                        learning rate for the generator\n  --critic-lr CRITIC_LR\n                        learning rate for the critic\n```\n\n## TensorboardX\n\nResults such as costs, generated images for tensorboard will be written to `./runs` folder.\n\nTo display the results to tensorboard, run: `tensorboard --logdir runs`\n\n## Acknowledgements\n\n* [github.com/jalola/improved-wgan-pytorch](https://github.com/jalola/improved-wgan-pytorch)\n* [igul222/improved_wgan_training](https://github.com/igul222/improved_wgan_training)\n* [caogang/wgan-gp](https://github.com/caogang/wgan-gp)\n* [LayerNorm](https://github.com/pytorch/pytorch/issues/1959)\n\n## License\n\nThis project is licensed under [Apache2](https://opensource.org/licenses/Apache-2.0).\nIt is based on [improved-wgan-pytorch](https://github.com/jalola/improved-wgan-pytorch),\nwhich is itself licensed under [MIT](https://opensource.org/licenses/MIT).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaferretti%2Fwgan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreaferretti%2Fwgan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaferretti%2Fwgan/lists"}