Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions model_compression/rounding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Rounding

### Rounding test of Mobilenet(1.0, 224 * 224 input) on flowers102 dataset.

| Model| Rounding | Without BN | Pruning| modelSize(gzip)|Accuracy | Download|
| ---- | --- | ---- | --- | --- | --- | ---|
|Mobilenet || | |12M|97.16%|[download](https://pan.baidu.com/s/1geHkrw3)|
|Mobilenet|√|||3.2M|97.05%|[download](https://pan.baidu.com/s/1bo5kqsR)|
|Mobilenet|||√|4.4M|96.96%|[download](https://pan.baidu.com/s/1ge8wOp1)|
|Mobilenet|√||√|2.3M|96.7%|[download](https://pan.baidu.com/s/1bpo5CMr)|
|Mobilenet||√||12M|97.16%|[download](https://pan.baidu.com/s/1slodbNR)|
|Mobilenet|√|√||3.0M|96.96%|[download](https://pan.baidu.com/s/1bo66hUR)|



## Principle

Given floating parameters `V`, first our goal is to represent `V` as 8-bit integers `V'`. And then we transformed back `V'` back into its approximate high-precision value by performing the inverse of the quantization operation. At last, we perform gzip to our quantized && inverse-quantized model. The whole process can reduces our model by 70%.

### Process
- First, we use UInt8 quantization, that is, the parameters are sacled to [0, 255]
![](../../source/rounding1.png)

- Second, we inverse the quantization.
![](../../source/rounding2.png)

In the last, We apply gzip to compress the inverse-quantized model, and the compression ratio can be up to 70%.

Binary file added source/rounding1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/rounding2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.