Incremental-Network-Quantization icon indicating copy to clipboard operation
Incremental-Network-Quantization copied to clipboard

Combination of pruning and INQ

Open DAVIDNEWGATE opened this issue 7 years ago • 18 comments

Dear Aojun, I have tried to implement your INQ following the paper, and it works pretty good. However, when I combine it with DNS or iterative pruning, the accuracy loss become large. I use the lager absolute value part to form quantization base, the partition is (0.2 0.4 0.6 0.8 1). It is on densenet. Do you have any insight for that case? Kind regards.

DAVIDNEWGATE avatar Aug 30 '17 08:08 DAVIDNEWGATE

the 5 bits quantization? the sparse model partition must be careful, such as 0.05, 0.1,0.15,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95,1.0. and more training epochs is useful.

AojunZhou avatar Aug 30 '17 22:08 AojunZhou

Thanks, I still don't really understand how to combine it with DNS, I have just done INQ after DNS, there is no difference with just using INQ

DAVIDNEWGATE avatar Sep 01 '17 03:09 DAVIDNEWGATE

yeah, I also just do INQ after DNS, only fixed the zero and using INQ to none-zero part.

AojunZhou avatar Sep 01 '17 11:09 AojunZhou

If we just fixed zero, will retrain recover the accuracy back to the level before INQ? Does that means we should only prune small part on pruning stage? If not, how did you finally get such high compression rate with high accuracy?

DAVIDNEWGATE avatar Sep 01 '17 16:09 DAVIDNEWGATE

To combine DNS and INQ, you need first run DNS to achieve target sparse rate (e.g., ~18X compression on AlexNet without accuracy loss). Then, you can run INQ over the final model from DNS while keeping zero values fixed (i.e., they are removed from the network). In our ICLR paper, we achieved such an impressive accuracy just in the above way. We have not tested the combination of running DNS and INQ simultaneously, as we clearly clarified in the paper.

YaoAnbang avatar Sep 02 '17 00:09 YaoAnbang

Thank you, I have tried 0.025 pace after quantization of 90%, the result is amazing. Another issue is that how do you deal with BN layers of resnet? Did you quantize them too?

DAVIDNEWGATE avatar Sep 07 '17 19:09 DAVIDNEWGATE

No, we don't quantize BN layers to low-precision, In my code, you must skip the bn layers.

AojunZhou avatar Sep 08 '17 03:09 AojunZhou

@Zhouaojun @DAVIDNEWGATE How to skip bn layers (include batchnorm layer and scale layer)?I don't know what exactly you mean。

KangolHsu avatar Sep 22 '17 06:09 KangolHsu

@KangolHsu you can skip the bn layers (include batch norm and scale layer), you can modify line 764 in "src/caffe/net.cpp" , we have added some comments in "src/caffe/net.cpp"

AojunZhou avatar Sep 22 '17 12:09 AojunZhou

thanks https://github.com/Zhouaojun/Incremental-Network-Quantization/blob/0548e144898ff5d6d6906ef7ea862bf5e01989f9/src/caffe/net.cpp#L763

KangolHsu avatar Sep 25 '17 01:09 KangolHsu

@Zhouaojun @DAVIDNEWGATE why the weights is not 2^(-n) after INQ ? I don't know why?

zlheos avatar Dec 15 '17 07:12 zlheos

@zlheos have you completed all quantization step ?

AojunZhou avatar Dec 17 '17 06:12 AojunZhou

@Zhouaojun I try to test lenet network , and complete all quantization step then , I find those weights value is not 2^(-n) I feel mask does not effect

zlheos avatar Dec 18 '17 06:12 zlheos

@Zhouaojun @zlheos Have you solved this problem? I got the same problem. I guess the structure of lenet network is too simple.

wellhao avatar Feb 25 '18 02:02 wellhao

@wellhao I train on tensorflow , and give right answer

zlheos avatar Feb 27 '18 09:02 zlheos

@zlheos could you give me some suggest?thank you!

wellhao avatar Feb 28 '18 01:02 wellhao

@KangolHsu ,Hi,can you give me some advice about how to modify bn layers?

litingsjj avatar May 26 '18 07:05 litingsjj

@wellhao I train on Tensorflow you can reference this repository https://github.com/DAVIDNEWGATE/Project

zlheos avatar Jun 04 '18 09:06 zlheos