Coder Social home page Coder Social logo

openxaiproject / attribution-preservation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from geondopark/attribute-preserve

1.0 1.0 0.0 500 KB

Attribution Preservation in Network Compression for Reliable Network Interpretation, NeurIPS 2020

Python 100.00%

attribution-preservation's Introduction

Attribution Preservation in Network Compression for Reliable Network Interpretation

This repository is the official PyTorch implementation of Attribution Preservation in Network Compression for Reliable Network Interpretation by Geondo Park, June Yong Yang, Sung Ju Hwang, Eunho Yang, NeurIPS 2020.

Requirements

The following requirements must be met:

  • Python 3.6+
  • CUDA 10.0+
  • torch 1.1+
  • torchvision 0.4+
  • SciPy 0.19.1+
  • imageio 2.8.0+

Preparing the Dataset

Create ./data directory and extract the PASCAL VOC 2012 dataset inside.

mkdir data
wget -nc -P ./data http://pjreddie.com/media/files/VOCtrainval_11-May-2012.tar
tar -xvf ./data/VOCtrainval_11-May-2012.tar -C ./data

Training the original model(teacher)

python voc_vanilla_main.py --gpu --exp_name "tutorial_teacher" --data_path ../../data/VOCdevkit/VOC2012 --imagenet_pretrained

Knowledge distillation

Overall hyperparameters for training are set by default. For stochastic matching, add --stochastic --drop_percent 0.3 arguments for all below scripts.

Inside directory ./pascal/distillation:

Distillation with sensitivity weighted attribution matching

python voc_distill_main.py --gpu --exp_name "tutorial_distillation" --arch VGG16_VOC_x8 --teacher_path weights/tutorial_teacher/tutorial_teacher_best.pth.tar --data_path ../../data/VOCdevkit/VOC2012 --transfer_type swa --transfer_weight 100

Structured Pruning (One-shot) with sensitivity weighted attribution matching

For stochastic matching, add --stochastic --drop_percent 0.3 arguments for all below scripts.

Overall hyperparameters for training are set by default. In folder ./pascal/structure:

python iteratrive_prune_distill.py --gpu --exp_name name --teacher_path weights/tutorial_teacher/tutorial_teacher_best.pth.tar --model_path <saved-start-model-path> --data_path ../../data/VOCdevkit/VOC2012 --percent 0.3 --iter 1 --transfer_type swa --transfer-weight 100

UnStructured Pruning (Iterative) with sensitivity weighted attribution matching

For stochastic matching, add --stochastic --drop_percent 0.3 arguments for all below scripts.

Overall hyperparameters for training are set by default. In folder ./pascal/unstructure:

python iteratrive_prune_distill.py --gpu --exp_name name --teacher_path weights/tutorial_teacher/tutorial_teacher_best.pth.tar --model_path <saved-start-model-path (teacher_path)> --data_path ../../data/VOCdevkit/VOC2012 --percent 0.2 --iter 16 --transfer_type swa --transfer-weight 100

Evaluation

To evaluate attribution scores, GradCam, LRP, EBP, and RAP were used.

To evaluate prediction and localization, run:

python evaluate_pred.py --gpu --data_path ../data/VOCdevkit/VOC2012 --path distillation/weights/tutorial_distill/tutorial_distill_best.pth.tar --compression kd --arch VGG16_VOC_x8
python evaluate_localization.py --gpu --data_path ../data/VOCdevkit/VOC2012 --path distillation/weights/tutorial_distill/tutorial_distill_best.pth.tar --compression kd --arch VGG16_VOC_x8 --method gcam --metric auc

Implementation

Citation

@inproceedings{park2020attribution,
  title={Attribution Preservation in Network Compression for Reliable Network Interpretation},
  author={Park, Geondo and Yang, June Yong and Hwang, Sung Ju and Yang, Eunho},
  journal={Advances in Neural Information Processing Systems},
  volume={33},
  year={2020}
}

attribution-preservation's People

Contributors

geondopark avatar laoconeth avatar

Stargazers

Heeyeon Nah avatar

Watchers

James Cloos 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.