Giter VIP home page Giter VIP logo

rdoq's Introduction

RDOQ: Effective Fine-Grained Quantization for DNNs via Rate-Distortion Optimization

Official implementation of the TPAMI submission: "RDOQ: Effective Fine-Grained Quantization for DNNs via Rate-Distortion Optimization".

Project Structure

This repository contains the post-training quantization implementation of both ImageNet classification and 3D LiDAR based object detection models, organized in the subdirectory respectively:

  1. ImageNet classification: ./classification
  2. 3D LiDAR based Object Detection: ./openpcdet

ImageNet classification

Example scripts to evaluate the accuracy on ImageNet validation dataset:

  1. Generate rate-distortion curves for channel groups in ViT layer weights.
    CUDA_VISIBLE_DEVICES=0 python3 generate_RD_curves_weight_inchangroup.py \
     --archname deit_base_patch16_224 \
     --datapath=/imagenet/ \
     --modeid=0 --gpuid=0 \
     --nchannelbatch 128 \
     --testsize=64 \
     --batchsize 64 
  2. Generate rate-distortion curves for channel groups in ViT layer activations.
    CUDA_VISIBLE_DEVICES=0 python3 generate_RD_curves_act_nchan.py \
     --archname deit_base_patch16_224 \
     --datapath=/imagenet/ \
     --modeid=0 --gpuid=0 \
     --nchannelbatch 128 \
     --testsize=64 \
     --batchsize 64
  3. (Option #1) Pareto-frontier method for bit allocation:
    CUDA_VISIBLE_DEVICES=0 python3 generate_RD_frontier_batch_distortion_act_nchan.py \
     --archname=deit_base_patch16_224 \
     --maxslopesteps 196 \
     --pathrdcurve=deit_base_patch16_224_ndz_0010_nr_0011_ns_0064_nf_0128_rdcurves_channelwise_opt_dist/ \
     --gpuid=0 \
     --datapath=/imagenet \
     --nchannelbatch=128 \
     --maxrates=11 \
     -bcw -bca
  4. (Option #2) Dynamic Programming method for bit allocation:
    CUDA_VISIBLE_DEVICES=0 python3 generate_DP_batch_distortion_act_nchan.py \
     --archname=deit_base_patch16_224 \
     --maxslopesteps 196 \
     --pathrdcurve=deit_base_patch16_224_ndz_0010_nr_0011_ns_0064_nf_0128_rdcurves_channelwise_opt_dist/ \
     --gpuid=0 \
     --datapath=/imagenet \
     --nchannelbatch=128 \
     --maxrates=11 \
     --target_rates 4 6 8 \
     -bcw -bca

3D LiDAR based Object Detection

Preparation:

Follow installation instructions in OpenPCDet

  1. Generate rate-distortion curves for channel groups in detection model layer weights.

    CUDA_VISIBLE_DEVICES=0 python3 generate_rd_curves_batch.py \
       --batch_size 2 --cfg_file cfgs/nuscenes_models/cbgs_voxel0075_voxelnext_vtc.yaml \
       --pretrained_model path/to/model.pth.tar \
       --workers 1
  2. Dynamic Programming method for bit allocation:

    CUDA_VISIBLE_DEVICES=0 python3 generate_DP_frontier_batch_act_nchan.py \
     --batch_size 32 --workers 4 \
     --cfg_file cfgs/nuscenes_models/cbgs_voxel0075_voxelnext_vtc.yaml \
     --pretrained_model path/to/model.pth.tar \
     --nchannelbatch 128 \
     --pathrdcurve VoxelNeXt_ndz_0010_nr_0011_ns_0001_nf_0128_rdcurves_channelwise_opt_dist/ \
     --target_rates 2 4 6 8 -bcw

rdoq's People

Contributors

akimoto-cris 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.