Back to Models

Training with Pruning

official/projects/pruning/README.md

2.20.02.8 KB
Original Source

Training with Pruning

[TOC]

⚠️ Disclaimer: All datasets hyperlinked from this page are not owned or distributed by Google. The dataset is made available by third parties. Please review the terms and conditions made available by the third parties before using the data.

Overview

This project includes pruning codes for TensorFlow models. These are examples to show how to apply the Model Optimization Toolkit's pruning API.

How to train a model

bash
EXPERIMENT=xxx  # Change this for your run, for example, 'resnet_imagenet_pruning'
CONFIG_FILE=xxx  # Change this for your run, for example, path of imagenet_resnet50_pruning_gpu.yaml
MODEL_DIR=xxx  #  Change this for your run, for example, /tmp/model_dir
python3 train.py \
  --experiment=${EXPERIMENT} \
  --config_file=${CONFIG_FILE} \
  --model_dir=${MODEL_DIR} \
  --mode=train_and_eval

Accuracy

<figure align="center"> <figcaption>Comparison of Imagenet top-1 accuracy for the classification models</figcaption> </figure>

Note: The Top-1 model accuracy is measured on the validation set of ImageNet.

Pre-trained Models

Image Classification

ModelResolutionTop-1 Accuracy (Dense)Top-1 Accuracy (50% sparsity)Top-1 Accuracy (80% sparsity)ConfigDownload
MobileNetV2224x22472.768%71.334%61.378%configTFLite(50% sparsity),
ResNet50224x22476.704%76.61%75.508%configTFLite(80% sparsity)