{"id":29023447,"url":"https://github.com/rish-16/cyclegansformer","last_synced_at":"2025-06-26T03:06:25.706Z","repository":{"id":52975243,"uuid":"347829500","full_name":"rish-16/CycleGANsformer","owner":"rish-16","description":"Unpaired Image-to-Image Translation with Transformer-based GANs in PyTorch [WIP]","archived":false,"fork":false,"pushed_at":"2021-07-29T04:30:12.000Z","size":35,"stargazers_count":39,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2023-03-08T23:03:10.256Z","etag":null,"topics":["generative-adversarial-network","image-generation","transformer"],"latest_commit_sha":null,"homepage":"https://rish-16.github.io/CycleGANsformer/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rish-16.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}},"created_at":"2021-03-15T03:53:19.000Z","updated_at":"2023-01-16T12:32:43.000Z","dependencies_parsed_at":"2022-09-08T00:21:47.142Z","dependency_job_id":null,"html_url":"https://github.com/rish-16/CycleGANsformer","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/rish-16/CycleGANsformer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rish-16%2FCycleGANsformer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rish-16%2FCycleGANsformer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rish-16%2FCycleGANsformer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rish-16%2FCycleGANsformer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rish-16","download_url":"https://codeload.github.com/rish-16/CycleGANsformer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rish-16%2FCycleGANsformer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261990350,"owners_count":23241190,"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":["generative-adversarial-network","image-generation","transformer"],"created_at":"2025-06-26T03:06:25.237Z","updated_at":"2025-06-26T03:06:25.693Z","avatar_url":"https://github.com/rish-16.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CycleGANsformer\nUnpaired Image-to-Image Translation using Transformer-based GANs.\n\n### About\nThis is an independent research project to build a Convolution-free GAN using Transformers for unpaired image-to-image translation between two domains (eg: horse and zebra, painting and photograph, seasons, etc.). It's fully implemented with `pytorch` and `torchvision`, and was inspired by the GANsformer, TransGAN, and CycleGAN papers.\n\n### Usage [WIP]\nI've prepared a `CycleGANsformer` wrapper over the entire model. You can install it via `pip` like so:\n\n```bash\n$ pip install pytorch-cyclegansformer\n```\n\nYou can use the wrapper like so:\n\n```python\nimport torch\nfrom cyclegansformer import CycleGANsformer\n\nx = torch.rand(1, 256, 256, 3) # your input image\ncgf = CycleGANsformer()\n\noutput_img = cgf(x) # can be viewed using matplotlib\n```\n\n### Training [WIP]\nYou can even train your own CycleGANsformer from scratch using the provided `ImageDatasetLoader`. Here, `path_to_x` and `path_to_y` represent the canonical filepaths to your training dataset comprising of two disjoint sets of images from two domains (eg: horses and zebras). Ensure you have the following directory structure:\n\n```\nmy_image_dataset/\n    |- train/\n        |- HORSES\n            |- horse_1.jpg\n            |- horse_2.jpg\n            |- ...\n            |- horse_n.jpg\n        |- ZEBRAS\n            |- zebra_1.jpg\n            |- zebra_2.jpg\n            |- ...\n            |- zebra_m.jpg\n    |- test/\n        |- HORSES\n            |- horse_1.jpg\n            |- horse_2.jpg\n            |- ...\n            |- horse_n.jpg\n        |- ZEBRAS\n            |- zebra_1.jpg\n            |- zebra_2.jpg\n            |- ...\n            |- zebra_m.jpg\n```\n\n\u003e Here, `n` is the number of horse images (X) and `m` is the number of zebra images (Y). \n\nOnce ready, you can start the training process (ideally on some acceleration hardware) like so:\n\n```python\nimport torch\nfrom cyclegansformer import CycleGANsformer, ImageDatasetLoader\n\nimg_ds = ImageDatasetLoader(path_to_x, path_to_y)\ncgf = CycleGANsformer()\n\ncgf.fit(img_ds, epochs=200, alpha_decay=True) # proceeds to train – ideally use GPU, not CPU\n```\n\n### Credits\nCredits to Aladdin Persson for the CycleGAN tutorial found [here](https://www.youtube.com/watch?v=4LktBHGCNfw), to Phil Wang for his implementation of the [Vision Transformer](https://github.com/lucidrains/vit-pytorch/blob/main/vit_pytorch/vit.py) by Dosovitskiy et al., and [TransGAN](https://arxiv.org/abs/2102.07074) by Jiang et al.\n\n### License\n[MIT](https://github.com/rish-16/CycleGANsformer/blob/rish-dev/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frish-16%2Fcyclegansformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frish-16%2Fcyclegansformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frish-16%2Fcyclegansformer/lists"}