{"id":19187454,"url":"https://github.com/materight/unpaired-spade","last_synced_at":"2026-07-12T01:31:07.328Z","repository":{"id":93569074,"uuid":"433879835","full_name":"materight/unpaired-SPADE","owner":"materight","description":"Unpaired Semantic Segmentation and Image Synthesis based on SPADE and UPerNet.","archived":false,"fork":false,"pushed_at":"2022-08-19T08:17:32.000Z","size":22147,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-29T08:51:27.225Z","etag":null,"topics":["gan","image-synthesis","pytroch","semantic-segmentation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/materight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2021-12-01T15:23:37.000Z","updated_at":"2022-10-06T11:36:37.000Z","dependencies_parsed_at":"2023-03-21T00:46:39.163Z","dependency_job_id":null,"html_url":"https://github.com/materight/unpaired-SPADE","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/materight/unpaired-SPADE","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/materight%2Funpaired-SPADE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/materight%2Funpaired-SPADE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/materight%2Funpaired-SPADE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/materight%2Funpaired-SPADE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/materight","download_url":"https://codeload.github.com/materight/unpaired-SPADE/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/materight%2Funpaired-SPADE/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35379590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"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":["gan","image-synthesis","pytroch","semantic-segmentation"],"created_at":"2024-11-09T11:19:06.165Z","updated_at":"2026-07-12T01:31:07.318Z","avatar_url":"https://github.com/materight.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unpaired Semantic Segmentation and Image Synthesis with SPADE and UPerNet\n\nAn adaptation of [SPADE](https://github.com/NVlabs/SPADE.git) to unpaired data samples. It exploits a semantic segmentation network (from [CSAILVision's semantic segmentation](https://github.com/CSAILVision/semantic-segmentation-pytorch)) to introduce a reconstruction loss over the semantic labels. Check the [presentation](./slides.pdf) for more details.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"docs/images/results2.jpg\" width=\"450\" /\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"docs/images/ocean.gif\" height=\"180\" /\u003e\n  \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003cimg src=\"docs/images/treepond.gif\" height=\"180\"/\u003e\n\u003c/div\u003e\n\n### Model architecture\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"docs/images/new_model_full.png\" width=\"800\"/\u003e\n\u003c/div\u003e\n\n\n## Get started\n\nClone this repo.\n```bash\ngit clone https://github.com/materight/unpaired-SPADE.git\ncd unpaired-SPADE/\n```\n\nThis code requires PyTorch 1.0 and python 3+. Please install dependencies by\n```bash\npip install -r requirements.txt\n```\n\n\n## Dataset preparation\n\nFor COCO-Stuff, Cityscapes or ADE20K, the datasets can be downloaded and prepared following [SPADE](https://github.com/NVlabs/SPADE#dataset-preparation). \n\nThe ADE20K dataset used to test the model can be downloaded [here](http://data.csail.mit.edu/places/ADEchallenge/ADEChallengeData2016.zip) (from [MIT Scene Parsing BenchMark](http://sceneparsing.csail.mit.edu/)). After the download, unzip it inside the the `datasets/` directory. \n\n\n## Testing pre-trained models\n\nOnce the dataset is ready, the result images can be generated using a pre-trained model:\n\n1. Download the zip of the pre-trained models from [here](https://drive.google.com/uc?id=1ocEiHW1CDFK22LIwxCogX32RYomGWztH) and unzip them inside the `checkpoints/` directory.\n\n2. Generate images using a pre-trained model.\n    ```bash\n    python test.py --name [experiment] --dataset_mode [dataset] --dataroot [path_to_dataset] --evaluate --load_from_opt_file\n    ```\n    `[experiment]` is the directory name of the checkpoint file downloaded in Step 1. `[dataset]` can be one of `coco`, `ade20k`, and `cityscapes`, and `[path_to_dataset]` is the path to the dataset. If you are running on CPU mode, append `--gpu_ids -1`.\n\n3. The outputs images are stored at `./results/[type]_pretrained/` by default. You can view them using the autogenerated HTML file in the directory. Use `--results_dir` to specify an alternative output directory. \n\nUse `--evaluate` to also compute FID score, mIoU and accuracy over the generated images. If you want to testo only over a subset of the dataset, use `--how_many` to specify the maximum number of images to generate. \n\nThere are many other options that can be specified, please use `python test.py --help` to see them all.  \n\n\n## Training new models\n\nNew models can be trained with the following command.\n\n```bash\npython train.py --name [experiment_name] --dataset_mode [dataset_mode] --dataroot [path_to_ade20k_dataset]\n```\n\nYou can use `python train.py --help` to see all the available options.\n\n\n## Available options\n\nBesides the options from the original [SPADE](https://github.com/NVlabs/SPADE.git) repository, new options have been added:\n- `--evaluate`: use with `test.py` to compute also FID, mIoU and accuracy scores over the generated images.\n- `--use_seg`: enable unpaired training with a cycle-consistency loss and a semantic segmentation model.\n- `--netS`: select the model to use for the semantic segmentation model.\n- `--pretrained_seg`: use pretrained weights for the semantic segmentation model.\n- `--use_input_seg`: use also the paired semantic label to further train the semantic segmentation network.\n- `--lambda_seg`: lambda parameter to re-weight the semantic segmentation loss.\n- `--beta_seg`: beta value for the class-balanced loss for semantic segmentation.\n- `--gamma_seg`: gamma parameter for the semantic segmentation focal loss.\n\n\n## Code structure\n\n- `train.py`, `test.py`: the entry point for training and testing.\n- `trainers/pix2pix_trainer.py`: harnesses and reports the progress of training.\n- `models/pix2pix_model.py`: creates the networks, and compute the losses\n- `models/networks/`: defines the architecture of all models\n- `options/`: creates option lists using `argparse` package. More individuals are dynamically added in other files as well. Please see the section below.\n- `data/`: defines the class for loading images and label maps.\n\n\n## Acknowledgments\nThis code borrows heavily from [SPADE](https://github.com/NVlabs/SPADE.git) and [CSAILVision's Semantic Segmentation](https://github.com/CSAILVision/semantic-segmentation-pytorch).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateright%2Funpaired-spade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmateright%2Funpaired-spade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateright%2Funpaired-spade/lists"}