Giter Club home page Giter Club logo

optimizing-deep-learning-models-for-arm-cortex-m-through-pruning's Introduction

Optimizing Deep Learning Models for ARM Cortex-M Through Pruning

I integrated two types of model pruning methods and ported them to the ARM Cortex-M using the CMSIS library.

Requirement

Pruning methods

System flow

figure1

Example command

Train Alexnet-Light on CIFAR10 and prune it.

python pruning.py --dataset cifar10 --model alexnet-light --lr 0.001 --epochs 80 --retrain-epochs 80 --prune-layers conv1 conv2 conv3 conv4 --prune-channels 0 0 10 10 --sensitivity 0.8

Load a well-trained model and prune it.

python pruning.py --dataset cifar10 --model alexnet-light --lr 0.001 --retrain-epochs 80 --prune-layers conv1 conv2 conv3 conv4 --prune-channels 0 0 10 10 --sensitivity 0.8 --no-train True --load-path .\saves\alexnet_nopruned_7722_7692.ptmodel

Quantization and generate cortexm_weight.h for NuMaker-PFM-M487

python inference_alexnet.py

Results

  • Inference time was measured on NuMaker-PFM-M487.
  • Accuracy was simulated on PC with CMSIS library.

LeNet-Light with MNIST

figure2

Before After
Inference time 30ms 22ms
Accuracy 99.11% 98.55%

Alexnet-Light with CIFAR10

figure3

Before After
Inference time 20ms 14ms
Accuracy 76.92% 75.15%
  • The inference time of Alexnet-Light(kernel size:3x3) is lower than LeNet-Light(kernel size:5x5) because of conv kernel size.

VGG-Light with CIFAR10

figure4

Before After
Inference time 47ms 32ms
Accuracy 78.98% 77.84%

optimizing-deep-learning-models-for-arm-cortex-m-through-pruning's People

Contributors

mshirw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

optimizing-deep-learning-models-for-arm-cortex-m-through-pruning's Issues

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.