Giter Club home page Giter Club logo

lottery_ticket_hypothesis's Introduction

CIFAR-10 Image Classification with Pruning in Convolutional Neural Networks (CNNs)

This repository contains code implementing a CNN-based classifier for the CIFAR-10 dataset. The model architecture includes convolutional and fully connected layers. Additionally, it incorporates a pruning mechanism inspired by Lottery Ticket Hypothesis to achieve sparsity in the network.

Overview

The code provided here involves:

  • Preprocessing CIFAR-10 dataset and setting up data loaders for training and testing.
  • Implementing a CNN-based model architecture named Network that consists of convolutional and fully connected layers.
  • Training the model using a specified number of epochs, rounds, and sparsity levels.
  • Implementing a pruning mechanism to prune weights from convolutional and linear layers based on the Lottery Ticket Hypothesis.
  • Evaluating the accuracy of the model before and after pruning, with and without retraining.

Prerequisites

  • Python 3.x
  • PyTorch
  • Matplotlib
  • NumPy
  • scikit-learn

Model Architecture

The Network class represents the CNN architecture. It comprises convolutional layers followed by fully connected layers.

Pruning Mechanism

The code implements a pruning mechanism inspired by the Lottery Ticket Hypothesis. The Lottery Ticket Hypothesis, proposed by Jonathan Frankle and Michael Carbin, posits that within large neural networks, there exist sparse subnetworks (winning tickets) that can match the performance of the original network when trained in isolation. These subnetworks can be uncovered by iterative pruning and retraining of the network's weights.

Key Points:

  • Sparse Subnetworks: Despite the over-parameterization in deep neural networks, there exist small, trainable subnetworks that achieve comparable performance.
  • Iterative Pruning: The process involves iteratively pruning connections or weights based on their magnitudes and then retraining the pruned network to recover performance.
  • Transferability: These winning tickets or sparse subnetworks can be transferred across different tasks and architectures.

Understanding this hypothesis aids in exploring strategies for network compression, acceleration, and understanding the underlying structure of deep learning models.

Testing

The code evaluates the model accuracy before and after pruning, with and without retraining, on the CIFAR-10 test dataset.

References

This implementation incorporates ideas from the Lottery Ticket Hypothesis for CNN pruning. For more information, refer to the original paper:

The Lottery Ticket Hypothesis: Finding Sparse, Trainable Neural Networks by Jonathan Frankle and Michael Carbin.

lottery_ticket_hypothesis's People

Contributors

anirvan-krishna avatar

Watchers

Kostas Georgiou avatar  avatar

Forkers

janew01

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.