Online Multi-Granularity Distillation for GAN Compression (ICCV2021)

Related tags

Deep Learning OMGD
Overview

Online Multi-Granularity Distillation for GAN Compression (ICCV2021)

This repository contains the pytorch codes and trained models described in the ICCV2021 paper "Online Multi-Granularity Distillation for GAN Compression" By Yuxi Ren*, Jie Wu*, Xuefeng Xiao, Jianchao Yang.

Overview

overview

Performance

performance

Prerequisites

  • Linux
  • Python 3
  • CPU or NVIDIA GPU + CUDA CuDNN

Getting Started

Installation

  • Clone this repo:

    git clone https://github.com/bytedance/OMGD.git
    cd OMGD
  • Install dependencies.

    conda create -n OMGD python=3.7
    conda activate OMGD
    pip install torch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 
    pip install -r requirements.txt 

Data preparation

  • edges2shoes
  • cityscapes
  • horse2zebra
  • summer2winter

Training

  • pretrained vgg16 we should prepare weights of a vgg16 to calculate the style loss

  • train student model using OMGD Run the following script to train a unet-style student on cityscapes dataset, all scripts for cyclegan and pix2pix on horse2zebra,summer2winter,edges2shoes and cityscapes can be found in ./scripts

    bash scripts/unet_pix2pix/cityscapes/distill.sh

Testing

  • test student models, FID or mIoU will be calculated, take unet-style generator on cityscapes dataset as an example

    bash scripts/unet_pix2pix/cityscapes/test.sh

Citation

If you use this code for your research, please cite our paper.

Acknowledgements

Our code is developed based on GAN Compression

Comments
  • get_real_stat.py

    get_real_stat.py

    @WuJie1010 Hi there, why don't you include the "get_real_stat.py" in the OMGD repository so that we can test on different images waiting for your reply

    opened by seekingdeep 2
  • About

    About "n_share" in netD

    Thanks for your work! I noticed that in distill.sh the n_shared parameter was setted to be 5 https://github.com/bytedance/OMGD/blob/e70a3cc4397808b933ed41fff2435a60b144b523/scripts/unet_pix2pix/cityscapes/distill.sh#L7

    And in discriminator forward code: https://github.com/bytedance/OMGD/blob/e70a3cc4397808b933ed41fff2435a60b144b523/models/modules/discriminators.py#L102-L111

    So actually those all 5 blocks are using self.blockXs[-1], which means we only use one discriminator in pix2pix training, correct me if I'm wrong :-D

    opened by mazzzystar 1
  • Why OMGD reduces latency time by 90%?

    Why OMGD reduces latency time by 90%?

    Hi, thanks for the solid work. I have a question about the latency time. In Table 5 (arxiv), I am surprised OMGD reduces latency time by 90% on mobile phones? As I know, depthwise operations could slow down the latency time. OMGD contains depthwise and pointwise. How does OMGD get 10x speed up? What are the differences between servers and mobile phones (tflite toolkits)? Thank you!

    opened by Wanggcong 1
  • No such file or directory: 'real_stat/cityscapes_A.npz'

    No such file or directory: 'real_stat/cityscapes_A.npz'

    在运行train和test的时候会出现No such file or directory: 'real_stat/cityscapes_A.npz' 这个文件在哪里可以获取? ` Traceback (most recent call last): File "test.py", line 98, in npz = np.load(opt.real_stat_path) File "/opt/AN/envs/OMGD/lib/python3.7/site-packages/numpy/lib/npyio.py", line 417, in load fid = stack.enter_context(open(os_fspath(file), "rb")) FileNotFoundError: [Errno 2] No such file or directory: 'real_stat/cityscapes_A.npz'

    `

    opened by TomatoBoy90 1
  • No handlers found:

    No handlers found: "aten::leaky_relu_".

    I get this warning: "torchprofile/profile.py:23: UserWarning: No handlers found: "aten::leaky_relu_". Skipped.". Did you have any ideas to solve it?

    opened by kasim0226 0
  • Reproduce unet_pix2pix, low performance

    Reproduce unet_pix2pix, low performance

    Evaluate epoch: 750 mIoU_teacher_w: 41.340 mIoU-best_teacher_w: 42.220 mIoU_teacher_d: 40.310 mIoU-best_teacher_d: 42.230 mIoU_student: 45.640 mIoU-best_student: 46.490

    lower than 48.91 in the paper.

    How can I solve it?

    Are there any tricks in the training?

    opened by huxiaotaostasy 0
  • a little issue

    a little issue

    Maybe this line should be replaced by model.save_student_networks(epoch), otherwise, it always saves the teacher model checkpoint. https://github.com/bytedance/OMGD/blob/e70a3cc4397808b933ed41fff2435a60b144b523/trainer.py#L121

    opened by zhuzhu18 1
Owner
Bytedance Inc.
Bytedance Inc.
An Image compression simulator that uses Source Extractor and Monte Carlo methods to examine the post compressive effects different compression algorithms have.

ImageCompressionSimulation An Image compression simulator that uses Source Extractor and Monte Carlo methods to examine the post compressive effects o

James Park 1 Dec 11, 2021
Pytorch implementation for Patient Knowledge Distillation for BERT Model Compression

Patient Knowledge Distillation for BERT Model Compression Knowledge distillation for BERT model Installation Run command below to install the environm

Siqi 180 Dec 19, 2022
[IJCAI-2021] A benchmark of data-free knowledge distillation from paper "Contrastive Model Inversion for Data-Free Knowledge Distillation"

DataFree A benchmark of data-free knowledge distillation from paper "Contrastive Model Inversion for Data-Free Knowledge Distillation" Authors: Gongfa

ZJU-VIPA 47 Jan 9, 2023
TF2 implementation of knowledge distillation using the "function matching" hypothesis from the paper Knowledge distillation: A good teacher is patient and consistent by Beyer et al.

FunMatch-Distillation TF2 implementation of knowledge distillation using the "function matching" hypothesis from the paper Knowledge distillation: A g

Sayak Paul 67 Dec 20, 2022
Perturbed Self-Distillation: Weakly Supervised Large-Scale Point Cloud Semantic Segmentation (ICCV2021)

Perturbed Self-Distillation: Weakly Supervised Large-Scale Point Cloud Semantic Segmentation (ICCV2021) This is the implementation of PSD (ICCV 2021),

null 12 Dec 12, 2022
AMTML-KD: Adaptive Multi-teacher Multi-level Knowledge Distillation

AMTML-KD: Adaptive Multi-teacher Multi-level Knowledge Distillation

Frank Liu 26 Oct 13, 2022
FuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space OptimizationFuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space Optimization

FuseDream This repo contains code for our paper (paper link): FuseDream: Training-Free Text-to-Image Generation with Improved CLIP+GAN Space Optimizat

XCL 191 Dec 31, 2022
DR-GAN: Automatic Radial Distortion Rectification Using Conditional GAN in Real-Time

DR-GAN: Automatic Radial Distortion Rectification Using Conditional GAN in Real-Time Introduction This is official implementation for DR-GAN (IEEE TCS

Kang Liao 18 Dec 23, 2022
YOLOv5 Series Multi-backbone, Pruning and quantization Compression Tool Box.

YOLOv5-Compression Update News Requirements 环境安装 pip install -r requirements.txt Evaluation metric Visdrone Model mAP mAP@50 Parameters(M) GFLOPs FPS@

ZhangYuan 719 Jan 2, 2023
Multi-Scale Aligned Distillation for Low-Resolution Detection (CVPR2021)

MSAD Multi-Scale Aligned Distillation for Low-Resolution Detection Lu Qi*, Jason Kuen*, Jiuxiang Gu, Zhe Lin, Yi Wang, Yukang Chen, Yanwei Li, Jiaya J

Jia Research Lab 115 Dec 23, 2022
Multi-Scale Aligned Distillation for Low-Resolution Detection (CVPR2021)

MSAD Multi-Scale Aligned Distillation for Low-Resolution Detection Lu Qi*, Jason Kuen*, Jiuxiang Gu, Zhe Lin, Yi Wang, Yukang Chen, Yanwei Li, Jiaya J

DV Lab 115 Dec 23, 2022
PocketNet: Extreme Lightweight Face Recognition Network using Neural Architecture Search and Multi-Step Knowledge Distillation

PocketNet This is the official repository of the paper: PocketNet: Extreme Lightweight Face Recognition Network using Neural Architecture Search and M

Fadi Boutros 40 Dec 22, 2022
Official code of ICCV2021 paper "Residual Attention: A Simple but Effective Method for Multi-Label Recognition"

CSRA This is the official code of ICCV 2021 paper: Residual Attention: A Simple But Effective Method for Multi-Label Recoginition Demo, Train and Vali

null 163 Dec 22, 2022
Pytorch implementation of CVPR2021 paper "MUST-GAN: Multi-level Statistics Transfer for Self-driven Person Image Generation"

MUST-GAN Code | paper The Pytorch implementation of our CVPR2021 paper "MUST-GAN: Multi-level Statistics Transfer for Self-driven Person Image Generat

TianxiangMa 46 Dec 26, 2022
Code of U2Fusion: a unified unsupervised image fusion network for multiple image fusion tasks, including multi-modal, multi-exposure and multi-focus image fusion.

U2Fusion Code of U2Fusion: a unified unsupervised image fusion network for multiple image fusion tasks, including multi-modal (VIS-IR, medical), multi

Han Xu 129 Dec 11, 2022
The official repo for OC-SORT: Observation-Centric SORT on video Multi-Object Tracking. OC-SORT is simple, online and robust to occlusion/non-linear motion.

OC-SORT Observation-Centric SORT (OC-SORT) is a pure motion-model-based multi-object tracker. It aims to improve tracking robustness in crowded scenes

Jinkun Cao 325 Jan 5, 2023
UMEC: Unified Model and Embedding Compression for Efficient Recommendation Systems

[ICLR 2021] "UMEC: Unified Model and Embedding Compression for Efficient Recommendation Systems" by Jiayi Shen, Haotao Wang*, Shupeng Gui*, Jianchao Tan, Zhangyang Wang, and Ji Liu

VITA 39 Dec 3, 2022
Code of paper "CDFI: Compression-Driven Network Design for Frame Interpolation", CVPR 2021

CDFI (Compression-Driven-Frame-Interpolation) [Paper] (Coming soon...) | [arXiv] Tianyu Ding*, Luming Liang*, Zhihui Zhu, Ilya Zharkov IEEE Conference

Tianyu Ding 95 Dec 4, 2022
Pytorch implementation of COIN, a framework for compression with implicit neural representations 🌸

COIN ?? This repo contains a Pytorch implementation of COIN: COmpression with Implicit Neural representations, including code to reproduce all experim

Emilien Dupont 104 Dec 14, 2022