From 21162a2a04db364da92d4cf3d95bc49d5c7b8818 Mon Sep 17 00:00:00 2001 From: Zhen Wang Date: Wed, 8 May 2019 10:29:43 +0800 Subject: [PATCH] update some slim result. (#2200) --- PaddleSlim/README.md | 15 ++++++++++++--- PaddleSlim/docs/demo.md | 18 +++++++++--------- PaddleSlim/docs/model_zoo.md | 26 ++++++++++++++------------ 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/PaddleSlim/README.md b/PaddleSlim/README.md index 342cc006..b12b3c3e 100644 --- a/PaddleSlim/README.md +++ b/PaddleSlim/README.md @@ -115,13 +115,22 @@ Paddle-Slim工具库有以下特点: ### 量化训练 -评估实验所使用数据集为ImageNet1000类数据,且以top-1准确率为衡量指标: +评估实验所使用数据集为ImageNet 1000类数据, 量化训练前后模型top-5/top-1准确率对比如下: | Model | FP32| int8(X:abs_max, W:abs_max) | int8, (X:moving_average_abs_max, W:abs_max) |int8, (X:abs_max, W:channel_wise_abs_max) | |:---|:---:|:---:|:---:|:---:| |MobileNetV1|89.54%/70.91%|89.64%/71.01%|89.58%/70.86%|89.75%/71.13%| |ResNet50|92.80%/76.35%|93.12%/76.77%|93.07%/76.65%|93.15%/76.80%| +量化训练前后,模型大小的变化对比如下: + +| Model | FP32 | int8(A:abs_max, W:abs_max) | int8, (A:moving_average_abs_max, W:abs_max) | int8, (A:abs_max, W:channel_wise_abs_max) | +| :--- | :---: | :---: | :---: | :---: | +| MobileNetV1 | 17M | 4.8M(-71.76%) | 4.9M(-71.18%) | 4.9M(-71.18%) | +| ResNet50 | 99M | 26M(-73.74%) | 27M(-72.73%) | 27M(-72.73%) | + +注:abs_max为动态量化,moving_average_abs_max为静态量化, channel_wise_abs_max是对卷积权重进行分channel量化。 + ### 卷积核剪切 数据:ImageNet 1000类 @@ -165,9 +174,9 @@ Paddle-Slim工具库有以下特点: |---|---|---| | Baseline|89.54% / 70.91%|17.0M| | ResNet50蒸馏|90.92% / 71.97%|17.0M| -| ResNet50蒸馏训 + 量化|90.94% / 72.08%|4.2M| +| ResNet50蒸馏训练 + 量化|90.94% / 72.01%|4.8M| | 剪切-50% FLOPS|89.13% / 69.83%|9.0M| -| 剪切-50% FLOPS + 量化|89.11% / 69.70%|2.3M| +| 剪切-50% FLOPS + 量化|89.11% / 69.20%|2.3M| ## 模型导出格式 diff --git a/PaddleSlim/docs/demo.md b/PaddleSlim/docs/demo.md index c3529d9f..999a4c8d 100644 --- a/PaddleSlim/docs/demo.md +++ b/PaddleSlim/docs/demo.md @@ -229,9 +229,9 @@ python compress.py \ 该示例结果如下: -| Model | int8量化(top1_acc)| -|---|---| -|MobileNetV1|71.00%| +| 模型(int8动态量化) | 模型大小 | 精度(top5/top1)| +|---|---|---| +|MobileNetV1|-71.76%(4.8M)|89.64% / 71.01%| ### 3.5 蒸馏后int8量化 @@ -252,9 +252,9 @@ python compress.py \ 该示例结果如下: -|- |精度(top5/top1) | -|---|---| -| ResNet50蒸馏训+量化|90.94% / 72.08%| +| 模型(ResNet50蒸馏训练+int8量化) | 模型大小 | 精度(top1) | +| --- | --- | --- | +| MobileNet v1 | -71.76%(4.8M)| 72.01% | ### 3.6 剪切后int8量化 @@ -273,6 +273,6 @@ python compress.py \ 该示例结果如下: -| 剪切FLOPS |剪切+量化(dynamic) -|---|---| -| -50%|89.11% / 69.70%| +| 模型(剪切FLOPS+动态int8量化) | 模型大小 | 精度(top1) | +| --- | --- | --- | +| MobileNet v1(剪切FLOPS -50%) | -86.47%(2.3M) | 69.20% | diff --git a/PaddleSlim/docs/model_zoo.md b/PaddleSlim/docs/model_zoo.md index eb35b4b1..25c7cad6 100644 --- a/PaddleSlim/docs/model_zoo.md +++ b/PaddleSlim/docs/model_zoo.md @@ -28,21 +28,23 @@ ## 1. int8量化训练 -评估实验所使用数据集为ImageNet 1000类,且以top-1准确率为衡量指标: +评估实验所使用数据集为ImageNet 1000类数据, 量化训练前后模型top-5/top-1准确率对比如下: -| Model | FP32| int8(A:abs_max, W:abs_max) | int8, (A:moving_average_abs_max, W:abs_max) |int8, (A:abs_max, W:channel_wise_abs_max) | +| Model | FP32| int8(X:abs_max, W:abs_max) | int8, (X:moving_average_abs_max, W:abs_max) |int8, (X:abs_max, W:channel_wise_abs_max) | |:---|:---:|:---:|:---:|:---:| -|MobileNetV1|[70.916%]()|[71.008%]()|[70.84%]()|[71.00%]()| -|ResNet50|[76.352%]()|[76.612%]()|[76.456%]()|[76.73%]()| +|MobileNetV1|[89.54% / 70.91%]()|[89.64% / 71.01%]()|[89.58% / 70.86%]()|[89.75% / 71.13%]()| +|ResNet50|[92.80% / 76.35%]()|[93.12% / 76.77%]()|[93.07% / 76.65%]()|[93.15% / 76.80%]()| 点击表中超链接即可下载预训练模型。 -模型大小变化: +量化训练前后,模型大小的变化对比如下: -| Model | FP32| int8(A:abs_max, W:abs_max) | int8, (A:moving_average_abs_max, W:abs_max) |int8, (A:abs_max, W:channel_wise_abs_max) | -|:---|:---:|:---:|:---:|:---:| -|MobileNetV1|17M|4.8M(1/3.54)|5.1M(1/3.33)|4.9M(1/3.47)| -|ResNet50|99M|26M(1/3.81)|27M(1/3.67)|27M(1/3.67)| +| Model | FP32 | int8(A:abs_max, W:abs_max) | int8, (A:moving_average_abs_max, W:abs_max) | int8, (A:abs_max, W:channel_wise_abs_max) | +| :--- | :---: | :---: | :---: | :---: | +| MobileNetV1 | 17M | 4.8M(-71.76%) | 4.9M(-71.18%) | 4.9M(-71.18%) | +| ResNet50 | 99M | 26M(-73.74%) | 27M(-72.73%) | 27M(-72.73%) | + +注:abs_max为动态量化,moving_average_abs_max为静态量化, channel_wise_abs_max是对卷积权重进行分channel量化。 ## 2. 剪切实验 @@ -198,9 +200,9 @@ optimizer = fluid.optimizer.Momentum( #### 实验结果 -|- |精度(top5/top1) |模型下载 | +|- |精度(top1) |模型下载 | |---|---|---| -| ResNet50蒸馏训+量化|90.94% / 72.08%| [点击下载]()| +| ResNet50蒸馏训练+量化| 72.01%| [点击下载]()| ### 4.2 剪切后量化 @@ -212,4 +214,4 @@ optimizer = fluid.optimizer.Momentum( | 剪切FLOPS |剪切+量化(dynamic)|模型下载 | |---|---|---| -| -50%|89.11% / 69.70%| [点击下载]()| +| -50%| 69.20%| [点击下载]()| -- GitLab