Coder Social home page Coder Social logo

omgd's Introduction

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". This algorithm is proposed by ByteDance, Intelligent Creation, CV AutoML Team (字节跳动-智能创作-CV AutoML团队).

Authors: 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

    • Download the dataset
    bash datasets/download_pix2pix_dataset.sh edges2shoes-r
    • Get the statistical information for the ground-truth images for your dataset to compute FID.
    bash datasets/download_real_stat.sh edges2shoes-r B
  • cityscapes

    • Download the dataset Download the dataset (gtFine_trainvaltest.zip and leftImg8bit_trainvaltest.zip) from here, and preprocess it.
    python datasets/get_trainIds.py database/cityscapes-origin/gtFine/
    python datasets/prepare_cityscapes_dataset.py \
    --gtFine_dir database/cityscapes-origin/gtFine \
    --leftImg8bit_dir database/cityscapes-origin/leftImg8bit \
    --output_dir database/cityscapes \
    --train_table_path datasets/train_table.txt \
    --val_table_path datasets/val_table.txt
    • Get the statistical information for the ground-truth images for your dataset to compute FID.
    bash datasets/download_real_stat.sh cityscapes A
  • horse2zebra

    • Download the dataset
    bash datasets/download_cyclegan_dataset.sh horse2zebra
    • Get the statistical information for the ground-truth images for your dataset to compute FID.
    bash datasets/download_real_stat.sh horse2zebra A
    bash datasets/download_real_stat.sh horse2zebra B
  • summer2winter

    • Download the dataset
    bash datasets/download_cyclegan_dataset.sh summer2winter_yosemite
    • Get the statistical information for the ground-truth images for your dataset to compute FID from here

Pretrained Model

We provide a list of pre-trained models in link. DRN model can used to compute mIoU link.

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.

@article{ren2021online,
title={Online Multi-Granularity Distillation for GAN Compression},
author={Ren, Yuxi and Wu, Jie and Xiao, Xuefeng and Yang, Jianchao},
journal={arXiv preprint arXiv:2108.06908},
year={2021}
}

Acknowledgements

Our code is developed based on GAN Compression

omgd's People

Contributors

wujie1010 avatar wujiebyte avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.