Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Unstructured Pruning Demo #964

Merged
merged 1 commit into from
Jul 12, 2019
Merged

Conversation

karanchahal
Copy link
Contributor

I was experimenting with pruning of object detection algorithms and was able to get some good results using the detectors in this repo. I though I'd share a popular technique for pruning via a demo here.

The algorithm used for pruning is from the "To Prune or not to Prune" paper that is incidentally used by the Tensorflow Model Optimisation Toolkit to perform pruning.

I was able to bring about a sparsity of 70% with almost no loss in mAP using this technique. I suspect getting upto a 90% sparsity is also possible with more training. Here I have only applied pruning masks to the convolutional filters (more specifically around 100 conv layers were pruned).

This branch of research is particularly exciting as one can (theoretically) get a lot of speed ups and compress the network more effectively. As pytorch is gearing up to support pruning and quantisation, I thought this would be a nice proof of concept. Maybe we can add support for general pruning into this repo by implementing the different algorithms in a subfolder.

Hope this demo isn't too out of scope for this repo.

Regards,
Karan

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jul 12, 2019
@karanchahal
Copy link
Contributor Author

Google colab demo link

Copy link
Contributor

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@fmassa fmassa merged commit 24c8c90 into facebookresearch:master Jul 12, 2019
@Darshan2701
Copy link

@karanchahal Thanks for an awesome work.
Quick question - Can this be used to prune just the Faster RCNN model? Using resnet50-FPN as the backbone?

@karanchahal
Copy link
Contributor Author

@Darshan2701 yes it definitely can. The good thing about this algorithm is that it's pretty general. Anything with a conv layer is prunable. Let me know it works out okay :)

@Darshan2701
Copy link

@karanchahal Thanks for the information, Karan. I will try to implement this and will let you know.

@92ypli
Copy link

92ypli commented Jul 24, 2019

@karanchahal Thanks for an awesome work.
Quick question - Can this be used to prune just the MobilenetV2 model?

@karanchahal
Copy link
Contributor Author

karanchahal commented Jul 25, 2019 via email

Lyears pushed a commit to Lyears/maskrcnn-benchmark that referenced this pull request Jun 28, 2020
@enoceanwei
Copy link

Google colab demo link

Dear Karanchahal,

First of all, I am very interesting your jobs, it is an awesome work.

I have followed the codes and try to run it in my local machine.,However, my machine can not resolute the below code:

"
BBoxAugCollator()
"

In other words, I can not find the "BBoxAugCollator" API in my env libraries, could you tell me how to add the API or solve the problem.

my envs is : win10 x64, conda python 3.5, cuda10.0, cudnn7.1, pytorch=1.1.0 torchvision=0.2.1

I am looking forward to your reply, many thanks.

Regards

Wei

@NikolasBielski
Copy link

@karanchahal have you used this for Matterport's MaskRCNN?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants