Coder Social home page Coder Social logo

fashion-mnist-tensorflow's Introduction

Pruning Fashion MNIST in TensorFlow

This repository is used for solving the task of pruning a neural network in TensorFlow. The example is set up using the Fashion MNIST dataset.

Table of Contents

Introduction

People have a tendency to simply create larger and larger neural networks to solve their problems. They do not realize that this comes at a cost, computation time and storage. The higher the amount of weights, the more storage your model is going to take up, and it is going to take longer to run and use the model. This is were pruning comes in handy, with pruning you are able to cut away the weights and not use them anymore. This project shows you can take a model that achieves 88% accuracy and prune away 90% of the weights and still keep a high accuracy (85%). The idea is very simple, pre-train a large model until it reaches a high accuracy, then prune away unimportant weights and re-train the model over multiple epochs.

Installation

To run this program you simply need a python 3.x (that works with TensorFlow).

Python

pip install -r requirements.txt

Usage

python main.py

There are multiple hyperparameters that can be set in the program, some of them are set from the main function, others are set as default values in the functions.

Results

Using the Fashion MNIST dataset, a model is first trained for 2500 epochs. Then that same model is re-trained with 10% of the weights pruned.

Pre-trained model

The accuracy of the pre-trained model over epochs. alt text

Pruned model

The pre-trained model, after being trained with 10%, 25%, 50%, and 90% sparsity respectively: alt text alt text alt text alt text

The red vertical line denotes when the pre-training stop and pruning begins.

License

The package is Open Source Software released under the APACHE license.

fashion-mnist-tensorflow's People

Contributors

cenh avatar

Stargazers

 avatar  avatar

Watchers

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