This is the pytorch implementation for the paper: *Learning Accurate Performance Predictors for Ultrafast Automated Model Compression*, which is in submission to TPAMI

Related tags

Deep LearningSeerNet
Overview

SeerNet

​ This is the pytorch implementation for the paper: Learning Accurate Performance Predictors for Ultrafast Automated Model Compression, which is in submission to TPAMI. This repo contains active sampling for training the performance predictor, optimizing the compression policy and finetuning on two datasets(VGG-small, ResNet20 on Cifar-10; ResNet18, MobileNetv2, ResNet50 on ImageNet) using our proposed SeerNet.

​ As for the entire pipeline, we firstly get a few random samples to pretrain the MLP predictor. After getting the pretrained predictor, we execute active sampling using evolution search to get samples, which are used to further optimize the predictor above. Then we search for optimal compression policy under given constraint utilizing the predictor. Finally, we finetune the policy until convergence.

Quick Start

Prerequisites

  • python>=3.5
  • pytorch>=1.1.0
  • torchvision>=0.3.0
  • other packages like numpy and sklearn

Dataset

If you already have the ImageNet dataset for pytorch, you could create a link to data folder and use it:

# prepare dataset, change the path to your own
ln -s /path/to/imagenet/ data/

If you don't have the ImageNet, you can use the following script to download it: https://raw.githubusercontent.com/soumith/imagenetloader.torch/master/valprep.sh

Active Sampling

You can run the following command to actively search the samples by evolution algorithm:

CUDA_VISIBLE_DEVICES=0 python PGD/search.py --sample_path=results/res18/resnet18_sample.npy --acc_path=results/res18/resnet18_acc.npy --lr=0.2 --batch=400 --epoch=1000 --save_path=search_result.npy --dim=57

Training performance predictor

You can run the following command to training the MLP predictor:

CUDA_VISIBLE_DEVICES=0 python PGD/regression/regression.py --sample_path=../results/res18/resnet18_sample.npy --acc_path=../results/res18/resnet18_acc.npy --lr=0.2 --batch=400 --epoch=5000 --dim=57

Compression Policy Optimization

After training the performance predictor, you can run the following command to optimize the compression policy:


# for resnet18, please use
python PGD/pgd_search.py --arch qresnet18 --layer_nums 19 --step_size 0.005 --max_bops 30 --pretrained_weight path\to\weight 


# for mobilenetv2, please use
python PGD/pgd_search.py --arch qmobilenetv2 --layer_nums 53 --step_size 0.005 --max_bops 8 --pretrained_weight path\to\weight 


# for resnet50, please use
python PGD/pgd_search.py --arch qresnet50 --layer_nums 52 --step_size 0.005 --max_bops 65 --pretrained_weight path\to\weight 

Finetune Policy

After optimizing, you can get the optimal quantization and pruning strategy list, and you can replace the strategy list in finetune_imagenet.py to finetune and evaluate the performance on ImageNet dataset. You can also use the default strategy to reproduce the results in our paper.

For finetuning ResNet18 on ImageNet, please run:

bash run/finetune_resnet18.sh

For finetuning MobileNetv2 on ImageNet, please run:

bash run/finetune_mobilenetv2.sh

For finetuning ResNet50 on ImageNet, please run:

bash run/finetune_resnet50.sh
Owner
IVG Lab, Department of Automation, Tsinghua Univeristy
FairMOT - A simple baseline for one-shot multi-object tracking

FairMOT - A simple baseline for one-shot multi-object tracking

Yifu Zhang 3.6k Jan 08, 2023
MagFace: A Universal Representation for Face Recognition and Quality Assessment

MagFace MagFace: A Universal Representation for Face Recognition and Quality Assessment in IEEE Conference on Computer Vision and Pattern Recognition

Qiang Meng 523 Jan 05, 2023
Hashformers is a framework for hashtag segmentation with transformers.

Hashtag segmentation is the task of automatically inserting the missing spaces between the words in a hashtag. Hashformers applies Transformer models

Ruan Chaves 41 Nov 09, 2022
Static Features Classifier - A static features classifier for Point-Could clusters using an Attention-RNN model

Static Features Classifier This is a static features classifier for Point-Could

ABDALKARIM MOHTASIB 1 Jan 25, 2022
Recursive Bayesian Networks

Recursive Bayesian Networks This repository contains the code to reproduce the results from the NeurIPS 2021 paper Lieck R, Rohrmeier M (2021) Recursi

Robert Lieck 11 Oct 18, 2022
Python code for loading the Aschaffenburg Pose Dataset.

Aschaffenburg Pose Dataset (APD) This repository contains Python code for loading and filtering the Aschaffenburg Pose Dataset. The dataset itself and

1 Nov 26, 2021
Official code of ICCV2021 paper "Residual Attention: A Simple but Effective Method for Multi-Label Recognition"

CSRA This is the official code of ICCV 2021 paper: Residual Attention: A Simple But Effective Method for Multi-Label Recoginition Demo, Train and Vali

163 Dec 22, 2022
Pytorch implementation of "Get To The Point: Summarization with Pointer-Generator Networks"

About this repository This repo contains an Pytorch implementation for the ACL 2017 paper Get To The Point: Summarization with Pointer-Generator Netwo

wxDai 7 Oct 14, 2022
Contenido del curso Bases de datos del DCC PUC versión 2021-2

IIC2413 - Bases de Datos Tabla de contenidos Equipo Profesores Ayudantes Contenidos Calendario Evaluaciones Resumen de notas Foro Política de integrid

54 Nov 23, 2022
PyTorch experiments with the Zalando fashion-mnist dataset

zalando-pytorch PyTorch experiments with the Zalando fashion-mnist dataset Project Organization ├── LICENSE ├── Makefile - Makefile with co

Federico Baldassarre 31 Sep 25, 2021
unofficial pytorch implement of "Squareplus: A Softplus-Like Algebraic Rectifier"

SquarePlus (Pytorch implement) unofficial pytorch implement of "Squareplus: A Softplus-Like Algebraic Rectifier" SquarePlus Squareplus is a Softplus-L

SeeFun 3 Dec 29, 2021
Python wrapper of LSODA (solving ODEs) which can be called from within numba functions.

numbalsoda numbalsoda is a python wrapper to the LSODA method in ODEPACK, which is for solving ordinary differential equation initial value problems.

Nick Wogan 52 Jan 09, 2023
Model that predicts the probability of a Twitter user being anti-vaccination.

stylebody {text-align: justify}/style AVAXTAR: Anti-VAXx Tweet AnalyzeR AVAXTAR is a python package to identify anti-vaccine users on twitter. The

10 Sep 27, 2022
One-line your code easily but still with the fun of doing so!

One-liner-iser One-line your code easily but still with the fun of doing so! Have YOU ever wanted to write one-line Python code, but don't have the sa

5 May 04, 2022
A new version of the CIDACS-RL linkage tool suitable to a cluster computing environment.

Fully Distributed CIDACS-RL The CIDACS-RL is a brazillian record linkage tool suitable to integrate large amount of data with high accuracy. However,

Robespierre Pita 5 Nov 04, 2022
Python Implementation of algorithms in Graph Mining, e.g., Recommendation, Collaborative Filtering, Community Detection, Spectral Clustering, Modularity Maximization, co-authorship networks.

Graph Mining Author: Jiayi Chen Time: April 2021 Implemented Algorithms: Network: Scrabing Data, Network Construbtion and Network Measurement (e.g., P

Jiayi Chen 3 Mar 03, 2022
An efficient PyTorch implementation of the evaluation metrics in recommender systems.

recsys_metrics An efficient PyTorch implementation of the evaluation metrics in recommender systems. Overview • Installation • How to use • Benchmark

Xingdong Zuo 12 Dec 02, 2022
Official PyTorch implementation of StyleGAN3

Modified StyleGAN3 Repo Changes Made tied to python 3.7 syntax .jpgs instead of .pngs for training sample seeds to recreate the 1024 training grid wit

Derrick Schultz (he/him) 83 Dec 15, 2022
Fast EMD for Python: a wrapper for Pele and Werman's C++ implementation of the Earth Mover's Distance metric

PyEMD: Fast EMD for Python PyEMD is a Python wrapper for Ofir Pele and Michael Werman's implementation of the Earth Mover's Distance that allows it to

William Mayner 433 Dec 31, 2022
Large-Scale Pre-training for Person Re-identification with Noisy Labels (LUPerson-NL)

LUPerson-NL Large-Scale Pre-training for Person Re-identification with Noisy Labels (LUPerson-NL) The repository is for our CVPR2022 paper Large-Scale

43 Dec 26, 2022