{"id":13958449,"url":"https://github.com/bytedance/OMGD","last_synced_at":"2025-07-21T00:30:50.695Z","repository":{"id":41271309,"uuid":"396592023","full_name":"bytedance/OMGD","owner":"bytedance","description":"Online Multi-Granularity Distillation for GAN Compression (ICCV2021)","archived":true,"fork":false,"pushed_at":"2022-10-08T10:30:56.000Z","size":1079,"stargazers_count":336,"open_issues_count":15,"forks_count":41,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-19T18:06:32.419Z","etag":null,"topics":["research"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytedance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-16T03:04:34.000Z","updated_at":"2025-04-08T03:30:28.000Z","dependencies_parsed_at":"2023-01-19T16:03:07.488Z","dependency_job_id":null,"html_url":"https://github.com/bytedance/OMGD","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bytedance/OMGD","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytedance%2FOMGD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytedance%2FOMGD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytedance%2FOMGD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytedance%2FOMGD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytedance","download_url":"https://codeload.github.com/bytedance/OMGD/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytedance%2FOMGD/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266221247,"owners_count":23894964,"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":["research"],"created_at":"2024-08-08T13:01:36.029Z","updated_at":"2025-07-21T00:30:50.286Z","avatar_url":"https://github.com/bytedance.png","language":"Python","funding_links":[],"categories":["其他_机器视觉"],"sub_categories":["网络服务_其他"],"readme":"# Online Multi-Granularity Distillation for GAN Compression (ICCV2021)\n\nThis repository contains the pytorch codes and trained models described in the ICCV2021 paper \"[Online Multi-Granularity Distillation for GAN Compression](https://arxiv.org/pdf/2108.06908.pdf)\".  This algorithm is proposed by ByteDance, Intelligent Creation, AutoML Team (字节跳动-智能创作-AutoML团队). \n\nAuthors: Yuxi Ren*, Jie Wu*, Xuefeng Xiao, Jianchao Yang.\n\n## Overview\n\n![overview](imgs/OMGD.png)\n\n## Performance\n\n![performance](imgs/performance.png)\n\n\n## Prerequisites\n\n* Linux\n* Python 3\n* CPU or NVIDIA GPU + CUDA CuDNN\n\n## Getting Started\n\n### Installation\n\n- Clone this repo:\n\n  ```shell\n  git clone https://github.com/bytedance/OMGD.git\n  cd OMGD\n  ```\n\n- Install dependencies.\n\n  ```shell\n  conda create -n OMGD python=3.7\n  conda activate OMGD\n  pip install torch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 \n  pip install -r requirements.txt \n  ```\n\n### Data preparation\n\n- edges2shoes\n\n    - Download the dataset\n    ```shell\n    bash datasets/download_pix2pix_dataset.sh edges2shoes-r\n    ```\n  \n    - Get the statistical information for the ground-truth images for your dataset to compute FID. \n    ```shell\n    bash datasets/download_real_stat.sh edges2shoes-r B\n    ```\n    \n- cityscapes\n    \n    - Download the dataset\n    Download the dataset (*gtFine_trainvaltest.zip* and *leftImg8bit_trainvaltest.zip*) from [here](https://cityscapes-dataset.com), and preprocess it. \n    ```shell\n    python datasets/get_trainIds.py database/cityscapes-origin/gtFine/\n    python datasets/prepare_cityscapes_dataset.py \\\n    --gtFine_dir database/cityscapes-origin/gtFine \\\n    --leftImg8bit_dir database/cityscapes-origin/leftImg8bit \\\n    --output_dir database/cityscapes \\\n    --train_table_path datasets/train_table.txt \\\n    --val_table_path datasets/val_table.txt\n    ```\n      \n    - Get the statistical information for the ground-truth images for your dataset to compute FID. \n    ```shell\n    bash datasets/download_real_stat.sh cityscapes A\n    ```\n\n- horse2zebra\n\n    - Download the dataset\n    ```shell\n    bash datasets/download_cyclegan_dataset.sh horse2zebra\n    ```\n\n    - Get the statistical information for the ground-truth images for your dataset to compute FID. \n    ```shell\n    bash datasets/download_real_stat.sh horse2zebra A\n    bash datasets/download_real_stat.sh horse2zebra B\n    ```\n    \n- summer2winter\n\n    - Download the dataset\n    ```shell\n    bash datasets/download_cyclegan_dataset.sh summer2winter_yosemite\n    ```\n    - Get the statistical information for the ground-truth images for your dataset to compute FID from [here](https://drive.google.com/drive/folders/1JKJlpUDdD4TdXdwPwfdWUiF4PsXLAbto)\n\n### Pretrained Model\n\nWe provide a list of pre-trained models in [link](https://drive.google.com/drive/folders/1lDSguCuRDKl2bKQzAuc8hR-UE7eTqWvW?usp=sharing). DRN model can used to compute mIoU [link](https://drive.google.com/drive/folders/0B_4LoEXGO1TwcmhzLXpWUVFEMXM?resourcekey=0-PMTQHtlWMtSBYozjajFLXA).\n\n\n### Training\n\n- pretrained vgg16\n  we should prepare weights of a vgg16 to calculate the style loss \n  \n- train student model using OMGD\n  Run the following script to train a unet-style student on cityscapes dataset, \n  all scripts for cyclegan and pix2pix on horse2zebra,summer2winter,edges2shoes and cityscapes can be found in ./scripts\n\n  ```shell\n  bash scripts/unet_pix2pix/cityscapes/distill.sh\n  ```\n\n### Testing\n\n- test student models, FID or mIoU will be calculated, take unet-style generator on cityscapes dataset as an example\n\n  ```shell\n  bash scripts/unet_pix2pix/cityscapes/test.sh\n  ```\n\n## Citation\n\nIf you use this code for your research, please cite our paper.\n  ```shell\n@article{ren2021online,\n  title={Online Multi-Granularity Distillation for GAN Compression},\n  author={Ren, Yuxi and Wu, Jie and Xiao, Xuefeng and Yang, Jianchao},\n  journal={arXiv preprint arXiv:2108.06908},\n  year={2021}\n}\n```\n\n## Acknowledgements\n\nOur code is developed based on [GAN Compression](https://github.com/mit-han-lab/gan-compression)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytedance%2FOMGD","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytedance%2FOMGD","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytedance%2FOMGD/lists"}