Skip to main content

StarGAN-PyTorch

Contents

Introduction

This repository contains an op-for-op PyTorch reimplementation of StarGAN: Unified Generative Adversarial Networks for Multi-Domain Image-to-Image Translation.

Getting Started

Requirements

  • Python 3.10+
  • PyTorch 2.1.0+
  • CUDA 11.8+
  • Ubuntu 22.04+

From PyPI

pip install stargan_pytorch -i https://pypi.org/simple

Local Install

git clone https://github.com/Lornatang/StarGAN-PyTorch.git
cd StarGAN-PyTorch
pip install -r requirements.txt
pip install -e .

All pretrained model weights

Test (e.g. CelebA-128x128)

# Download g_celeba128 model weights to `./results/pretrained_models`
wget https://huggingface.co/goodfellowliu/StarGAN-PyTorch/resolve/main/g_celeba128.pth.tar?download=true -O ./results/pretrained_models/g_celeba128.pth.tar
python ./tools/test.py ./configs/CelebA128.yaml
# Result will be saved to `./results/test/celeba128`

Train

Please refer to README.md in the data directory for the method of making a dataset.

# If you want to train StarGAN-CelebA-128x128, run this command
python3 ./tools/train.py ./configs/CelebA128.yaml
# If you want to train StarGAN-CelebA-256x256, run this command
python3 ./tools/train.py ./configs/CelebA256.yaml

The training results will be saved to ./results/train/celeba128 or ./results/train/celeba256.

Contributing

If you find a bug, create a GitHub issue, or even better, submit a pull request. Similarly, if you have questions, simply post them as GitHub issues.

I look forward to seeing what the community does with these models!

Credit

StarGAN: Unified Generative Adversarial Networks for Multi-Domain Image-to-Image Translation

Yunjey Choi, Minje Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, Jaegul Choo

Abstract
Recent studies have shown remarkable success in imageto-image translation for two domains. However, existing approaches have limited scalability and robustness in handling more than two domains, since different models should be built independently for every pair of image domains. To address this limitation, we propose StarGAN, a novel and scalable approach that can perform image-to-image translations for multiple domains using only a single model. Such a unified model architecture of StarGAN allows simultaneous training of multiple datasets with different domains within a single network. This leads to StarGAN’s superior quality of translated images compared to existing models as well as the novel capability of flexibly translating an input image to any desired target domain. We empirically demonstrate the effectiveness of our approach on a facial attribute transfer and a facial expression synthesis tasks.

[Paper] [Code(PyTorch)]

@misc{choi2018stargan,
      title={StarGAN: Unified Generative Adversarial Networks for Multi-Domain Image-to-Image Translation}, 
      author={Yunjey Choi and Minje Choi and Munyoung Kim and Jung-Woo Ha and Sunghun Kim and Jaegul Choo},
      year={2018},
      eprint={1711.09020},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Metadata

Release files for stargan-pytorch 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stargan-pytorch 0.1.0
File Size Uploaded Provenance Actions
stargan_pytorch-0.1.0.tar.gz 8.1 kB Without provenance Details for stargan_pytorch-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stargan-pytorch 0.1.0
File Interpreter ABI Platform Actions
stargan_pytorch-0.1.0-py3-none-any.whl Python 3 none any Details for stargan_pytorch-0.1.0-py3-none-any.whl

Total release size: 15.2 kB

Release files / stargan_pytorch-0.1.0.tar.gz

Download URL stargan_pytorch-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e60b20f28c695e1c8aadf3d1c8d29c593a31558853ae6514c3c568d7447842f9
BLAKE2b-256 checksum
How to use checksums
f9786b2cc407d1c1c45ad0e4c8f7576cfc65f962993e3d1a5ded453b5c4b1caf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / stargan_pytorch-0.1.0-py3-none-any.whl

Download URL stargan_pytorch-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7654100932a3c8cd4e4cf3e252c065c63c07c0070e443e1bbeb243492d27c812
BLAKE2b-256 checksum
How to use checksums
c2212c018237fc9af8e9a78692b9eba79296c435cbdccd6192156bbffd1da68f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for stargan-pytorch 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page