Skip to content

Commit

Permalink
support deployment of mobilenetv3 (#2256)
Browse files Browse the repository at this point in the history
* Mobilenet V3 to ONNX support

* Update supported_models.md

* Update supported_models.md

* Update mmpretrain.md

* Update mmpretrain.md

* Update mmpretrain.yml

* Update classification.py

---------

Co-authored-by: RunningLeon <maningsheng@sensetime.com>
  • Loading branch information
Macok and RunningLeon committed Sep 5, 2023
1 parent 123b9fc commit 58db0ad
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/en/03-benchmark/supported_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The table below lists the models that are guaranteed to be exportable to other b
| [ResNeXt](https://github.com/open-mmlab/mmpretrain/tree/main/configs/resnext) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [SE-ResNet](https://github.com/open-mmlab/mmpretrain/tree/main/configs/seresnet) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [MobileNetV2](https://github.com/open-mmlab/mmpretrain/tree/main/configs/mobilenet_v2) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [MobileNetV3](https://github.com/open-mmlab/mmpretrain/tree/main/configs/mobilenet_v3) | MMPretrain | Y | Y | Y | Y | N | Y | N | N |
| [ShuffleNetV1](https://github.com/open-mmlab/mmpretrain/tree/main/configs/shufflenet_v1) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [ShuffleNetV2](https://github.com/open-mmlab/mmpretrain/tree/main/configs/shufflenet_v2) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [VisionTransformer](https://github.com/open-mmlab/mmpretrain/tree/main/configs/vision_transformer) | MMPretrain | Y | Y | Y | Y | ? | Y | Y | N |
Expand Down
1 change: 1 addition & 0 deletions docs/en/04-supported-codebases/mmpretrain.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Besides python API, mmdeploy SDK also provides other FFI (Foreign Function Inter
| [ResNeXt](https://github.com/open-mmlab/mmpretrain/tree/main/configs/resnext) | Y | Y | Y | Y | Y | Y |
| [SE-ResNet](https://github.com/open-mmlab/mmpretrain/tree/main/configs/seresnet) | Y | Y | Y | Y | Y | Y |
| [MobileNetV2](https://github.com/open-mmlab/mmpretrain/tree/main/configs/mobilenet_v2) | Y | Y | Y | Y | Y | Y |
| [MobileNetV3](https://github.com/open-mmlab/mmpretrain/tree/main/configs/mobilenet_v3) | Y | Y | Y | Y | ? | Y |
| [ShuffleNetV1](https://github.com/open-mmlab/mmpretrain/tree/main/configs/shufflenet_v1) | Y | Y | Y | Y | Y | Y |
| [ShuffleNetV2](https://github.com/open-mmlab/mmpretrain/tree/main/configs/shufflenet_v2) | Y | Y | Y | Y | Y | Y |
| [VisionTransformer](https://github.com/open-mmlab/mmpretrain/tree/main/configs/vision_transformer) | Y | Y | Y | Y | ? | Y |
Expand Down
1 change: 1 addition & 0 deletions docs/zh_cn/03-benchmark/supported_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
| [ResNeXt](https://github.com/open-mmlab/mmpretrain/tree/main/configs/resnext) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [SE-ResNet](https://github.com/open-mmlab/mmpretrain/tree/main/configs/seresnet) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [MobileNetV2](https://github.com/open-mmlab/mmpretrain/tree/main/configs/mobilenet_v2) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [MobileNetV3](https://github.com/open-mmlab/mmpretrain/tree/main/configs/mobilenet_v3) | MMPretrain | Y | Y | Y | Y | N | Y | N | N |
| [ShuffleNetV1](https://github.com/open-mmlab/mmpretrain/tree/main/configs/shufflenet_v1) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [ShuffleNetV2](https://github.com/open-mmlab/mmpretrain/tree/main/configs/shufflenet_v2) | MMPretrain | Y | Y | Y | Y | Y | Y | Y | Y |
| [VisionTransformer](https://github.com/open-mmlab/mmpretrain/tree/main/configs/vision_transformer) | MMPretrain | Y | Y | Y | Y | ? | Y | Y | N |
Expand Down
1 change: 1 addition & 0 deletions docs/zh_cn/04-supported-codebases/mmpretrain.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ for label_id, score in result:
| [ResNeXt](https://github.com/open-mmlab/mmpretrain/tree/main/configs/resnext) | Y | Y | Y | Y | Y | Y |
| [SE-ResNet](https://github.com/open-mmlab/mmpretrain/tree/main/configs/seresnet) | Y | Y | Y | Y | Y | Y |
| [MobileNetV2](https://github.com/open-mmlab/mmpretrain/tree/main/configs/mobilenet_v2) | Y | Y | Y | Y | Y | Y |
| [MobileNetV3](https://github.com/open-mmlab/mmpretrain/tree/main/configs/mobilenet_v3) | Y | Y | Y | Y | ? | Y |
| [ShuffleNetV1](https://github.com/open-mmlab/mmpretrain/tree/main/configs/shufflenet_v1) | Y | Y | Y | Y | Y | Y |
| [ShuffleNetV2](https://github.com/open-mmlab/mmpretrain/tree/main/configs/shufflenet_v2) | Y | Y | Y | Y | Y | Y |
| [VisionTransformer](https://github.com/open-mmlab/mmpretrain/tree/main/configs/vision_transformer) | Y | Y | Y | Y | ? | Y |
Expand Down
3 changes: 2 additions & 1 deletion mmdeploy/codebase/mmpretrain/deploy/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ def get_postprocess(self, *args, **kwargs) -> Dict:
dict: Composed of the postprocess information.
"""
postprocess = self.model_cfg.model.head
if postprocess['type'] == 'EfficientFormerClsHead':
if postprocess['type'] in ('EfficientFormerClsHead',
'StackedLinearClsHead'):
postprocess['type'] = 'LinearClsHead'

if 'topk' not in postprocess:
Expand Down
11 changes: 11 additions & 0 deletions tests/regression/mmpretrain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,14 @@ models:
- *pipeline_ort_dynamic_fp32
- *pipeline_trt_dynamic_fp32
- *pipeline_openvino_dynamic_fp32

- name: MobileNetV3
metafile: configs/mobilenet_v3/metafile.yml
model_configs:
- configs/mobilenet_v3/mobilenet-v3-small_8xb128_in1k.py
pipelines:
- *pipeline_ts_fp32
- *pipeline_ort_dynamic_fp32
- *pipeline_trt_dynamic_fp16
- *pipeline_ncnn_static_fp32
- *pipeline_openvino_dynamic_fp32

0 comments on commit 58db0ad

Please sign in to comment.