Giter Site home page Giter Site logo

kkahatapitiya / linearconv Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 2.0 4.04 MB

Code for our WACV 2021 paper "Exploiting the Redundancy in Convolutional Filters for Parameter Reduction"

License: MIT License

Python 100.00%
redundancy correlation neural-network-compression deep-learning parameter-reduction cnns

linearconv's Introduction

Exploiting the Redundancy in Convolutional Filters for Parameter Reduction

This repository contains the source for our WACV 2021 paper Exploiting the Redundancy in Convolutional Filters for Parameter Reduction.

Introduction

Convolutional Neural Networks (CNNs) have achieved state-of-the-art performance in many computer vision tasks over the years. However, this comes at the cost of heavy computation and memory intensive network designs, suggesting potential improvements in efficiency. Convolutional layers of CNNs partly account for such an inefficiency, as they are known to learn redundant features. In this work, we exploit this redundancy, observing it as the correlation between convolutional filters of a layer, and propose an alternative approach to reproduce it efficiently. The proposed 'LinearConv' layer learns a set of orthogonal filters, and a set of coefficients that linearly combines them to introduce a controlled redundancy. We introduce a correlation-based regularization loss to achieve such flexibility over redundancy, and control the number of parameters in turn. This is designed as a plug-and-play layer to conveniently replace a conventional convolutional layer, without any additional changes required in the network architecture or the hyperparameter settings. Our experiments verify that LinearConv models achieve a performance on-par with their counterparts, with almost a 50% reduction in parameters on average, and the same computational requirement and speed at inference.

Proposed LinearConv operation

Classification Results

Comparison with SOTA

Dependencies

  • Python 3.6.8
  • PyTorch 1.1.0
  • torchvision 0.2.2
  • thop 0.0.22

Quick start

  • This repository contains multiple versions of LinearConv:

    • linearconv.py: vanilla version
    • linearconv_lowrank.py: version in which, the matrix of linear coefficients is decomposed into two low-rank matrices with constant rank.
    • linearconv_rankratio.py: version in which, the matrix of linear coefficients is decomposed into two low-rank matrices with the rank as a propotion of number of filters.
    • linearconv_sparse.py: version in which, the matrix of linear coefficients is pruned to be sparse.
  • corr_reg.py is the proposed correlation-based regularization loss whcih makes the primary filters of LinearConv, linearly-independent.

  • Use the code in dataloaders.py to select one of the datasets: CIFAR-10, CIFAR-100, MNIST, FashionMNIST and SVHN.

  • ./models/ contains the CNN architectures on which we tested our proposed LinearConv module. Run a model to train and evaluate performance. eg: python vgg_xcnn.py -t rank -r 1 will run the vanilla LinearConv (full-rank) on VGG11. -t sparse -s 0.25 corresponds to sparse version with the specified sparsity.

Reference

If you find our work useful, please consider citing our work:

@inproceedings{kahatapitiyaexploiting,
  title={Exploiting the Redundancy in Convolutional Filters for Parameter Reduction},
  author={Kahatapitiya, Kumara and Rodrigo, Ranga},
  booktitle={Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision},
  pages={1410--1420}
}

Acknowledgements

We implement our models based on torchvision/models and parameter/FLOP counter based on thop. We thank the original authors for their work.

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.