The-Learning-And-Vision-Atelier-LAVA / LLT

[CVPR 2022] Learnable Lookup Table for Neural Network Quantization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LLT

Pytorch implementation of "Learnable Lookup Table for Neural Network Quantization", CVPR 2022

[CVF] [Supp]

Overview

Image Classification (CIFAR-10)

Requirements

  • PyTorch
  • TorchVision
  • numpy

Train

python train.py --arch resnet20 --epochs 200 --batch_size 128 --learning_rate 0.01 --weight_decay 1e-4 --w_bits 4 --a_bits 4

Test

python test.py --arch resnet20 --batch_size 128 --w_bits 4 --a_bits 4

Results

Image Super-Resolution

Requirements

  • PyTorch == 1.1.0
  • numpy
  • skimage
  • imageio
  • cv2

Train

1. Prepare training data

1.1 Download DIV2K training data (800 training + 100 validtion images) from DIV2K dataset or SNU_CVLab.

1.2 Specify '--dir_data' based on the HR and LR images path. In option.py, '--ext' is set as 'sep_reset', which first convert .png to .npy. If all the training images (.png) are converted to .npy files, then set '--ext sep' to skip converting files.

For more informaiton, please refer to EDSR(PyTorch).

2. Prepare pre-trained full-precision model

2.1 Download pre-trained full-precision model (e.g., EDSR) to 'model/EDSR'.

3. Begin to train

python main.py --model EDSR --scale 4 --w_bits 4 --a_bits 4 --save EDSR_w4a4 --pre_train model/EDSR/EDSR_x4.pth --patch_size 48 --batch_size 12

Test

1. Prepare test data

Download benchmark datasets (e.g., Set5, Set14 and other test sets) and prepare HR/LR images in testsets/benchmark following the example of testsets/benchmark/Set5.

2. Begin to test

python main.py --dir_data testsets --data_test Set5 --model EDSR --scale 4 --w_bits 4 --a_bits 4 --pre_train experiment/EDSR_w4a4/model/model_40.pt --test_only --save_results

Results

Point Cloud Classification

Train & Test

To be updated

Results

Citation

@InProceedings{Wang2022Learnable,
  author    = {Wang, Longguang and Dong, Xiaoyu and Wang, Yingqian and Liu, Li and An, Wei and Guo, Yulan},
  title     = {Learnable Lookup Table for Neural Network Quantization},
  booktitle = {CVPR},
  year      = {2022},
  pages     = {12423--12433},
}

Acknowledgements

Part of the code is borrowed from APot. We thank the authors for sharing the codes.

About

[CVPR 2022] Learnable Lookup Table for Neural Network Quantization


Languages

Language:Python 100.0%