Skip to content

Commit 49006cc

Browse files
authored
Add paddle mobilenets (#3412)
1 parent 4661b06 commit 49006cc

File tree

16 files changed

+436
-2
lines changed

16 files changed

+436
-2
lines changed

demos/classification_benchmark_demo/cpp/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ omz_converter --list models.lst
6363
* mobilenet-v2-pytorch
6464
* mobilenet-v3-large-1.0-224-tf
6565
* mobilenet-v3-small-1.0-224-tf
66+
* mobilenet-v3-large-1.0-224-paddle
67+
* mobilenet-v3-small-1.0-224-paddle
6668
* nfnet-f0
6769
* octave-resnet-26-0.25
6870
* regnetx-3.2gf

demos/classification_benchmark_demo/cpp/models.lst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ mobilenet-v2-1.4-224
2727
mobilenet-v2-pytorch
2828
mobilenet-v3-large-1.0-224-tf
2929
mobilenet-v3-small-1.0-224-tf
30+
mobilenet-v3-large-1.0-224-paddle
31+
mobilenet-v3-small-1.0-224-paddle
3032
nfnet-f0
3133
octave-resnet-26-0.25
3234
regnetx-3.2gf

demos/classification_demo/python/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ omz_converter --list models.lst
6767
* mobilenet-v2-pytorch
6868
* mobilenet-v3-large-1.0-224-tf
6969
* mobilenet-v3-small-1.0-224-tf
70+
* mobilenet-v3-large-1.0-224-paddle
71+
* mobilenet-v3-small-1.0-224-paddle
7072
* nfnet-f0
7173
* octave-resnet-26-0.25
7274
* regnetx-3.2gf

demos/classification_demo/python/models.lst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ mobilenet-v2-1.4-224
2929
mobilenet-v2-pytorch
3030
mobilenet-v3-large-1.0-224-tf
3131
mobilenet-v3-small-1.0-224-tf
32+
mobilenet-v3-large-1.0-224-paddle
33+
mobilenet-v3-small-1.0-224-paddle
3234
nfnet-f0
3335
octave-resnet-26-0.25
3436
regnetx-3.2gf

models/public/device_support.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
| mobilenet-v2-pytorch | YES | YES | YES |
7979
| mobilenet-v3-large-1.0-224-tf | YES | YES | YES |
8080
| mobilenet-v3-small-1.0-224-tf | YES | YES | YES |
81+
| mobilenet-v3-large-1.0-224-paddle | YES | YES | YES |
82+
| mobilenet-v3-small-1.0-224-paddle | YES | YES | YES |
8183
| mobilenet-yolo-v4-syg | YES | YES | |
8284
| modnet-photographic-portrait-matting | YES | YES | YES |
8385
| modnet-webcam-portrait-matting | YES | YES | YES |

models/public/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@
7171
omz_models_model_mobilenet_v2_1_0_224
7272
omz_models_model_mobilenet_v2_1_4_224
7373
omz_models_model_mobilenet_v2_pytorch
74+
omz_models_model_mobilenet_v3_large_1_0_224_paddle
7475
omz_models_model_mobilenet_v3_large_1_0_224_tf
76+
omz_models_model_mobilenet_v3_small_1_0_224_paddle
7577
omz_models_model_mobilenet_v3_small_1_0_224_tf
7678
omz_models_model_nfnet_f0
7779
omz_models_model_octave_resnet_26_0_25
@@ -351,8 +353,8 @@ You can download models and convert them into OpenVINO™ IR format (\*.xml + \*
351353
| MobileNet V1 1.0 224 | Caffe\*<br>TensorFlow\* | [mobilenet-v1-1.0-224](./mobilenet-v1-1.0-224/README.md)<br>[mobilenet-v1-1.0-224-tf](./mobilenet-v1-1.0-224-tf/README.md)| 69.496%/89.224%<br>71.03%/89.94% | 1.148 | 4.221 |
352354
| MobileNet V2 1.0 224 | Caffe\*<br>TensorFlow\*<br>PyTorch\*| [mobilenet-v2](./mobilenet-v2/README.md) <br>[mobilenet-v2-1.0-224](./mobilenet-v2-1.0-224/README.md)<br>[mobilenet-v2-pytorch](./mobilenet-v2-pytorch/README.md) | 71.218%/90.178%<br>71.85%/90.69%<br>71.81%/90.396% | 0.615~0.876 | 3.489 |
353355
| MobileNet V2 1.4 224 | TensorFlow\* | [mobilenet-v2-1.4-224](./mobilenet-v2-1.4-224/README.md) | 74.09%/91.97% | 1.183 | 6.087 |
354-
| MobileNet V3 Small 1.0 | TensorFlow\* | [mobilenet-v3-small-1.0-224-tf](./mobilenet-v3-small-1.0-224-tf/README.md) | 67.36%/87.44% | 0.1168 | 2.537 |
355-
| MobileNet V3 Large 1.0 | TensorFlow\* | [mobilenet-v3-large-1.0-224-tf](./mobilenet-v3-large-1.0-224-tf/README.md) | 75.30%/92.62% | 0.4450 | 5.4721 |
356+
| MobileNet V3 Small 1.0 | TensorFlow\*<br>Paddle\* | [mobilenet-v3-small-1.0-224-tf](./mobilenet-v3-small-1.0-224-tf/README.md) <br> [mobilenet-v3-small-1.0-paddle](./mobilenet-v3-small-1.0-224-paddle/README.md) | 67.36%/87.44%<br>68.21%/88.04% | 0.1168<br>0.1269 | 2.537<br>2.9339 |
357+
| MobileNet V3 Large 1.0 | TensorFlow\*<br>Paddle\* | [mobilenet-v3-large-1.0-224-tf](./mobilenet-v3-large-1.0-224-tf/README.md)<br>[mobilenet-v3-large-1.0-224-paddle](./mobilenet-v3-large-1.0-224-paddle/README.md) | 75.30%/92.62%<br>75.248%/92.32% | 0.4450<br>0.4565 | 5.4721<br>5.468 |
356358
| NFNet F0 | PyTorch\* | [nfnet-f0](./nfnet-f0/README.md) | 83.34%/96.56% | 24.8053 | 71.4444 |
357359
| RegNetX-3.2GF | PyTorch\* | [regnetx-3.2gf](./regnetx-3.2gf/README.md) | 78.17%/94.08% | 6.3893 | 15.2653 |
358360
| ResNet 26, alpha=0.25 | MXNet\* | [octave-resnet-26-0.25](./octave-resnet-26-0.25/README.md) | 76.076%/92.584%| 3.768 | 15.99 |
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# mobilenet-v3-large-1.0-224-paddle
2+
3+
## Use Case and High-Level Description
4+
5+
`mobilenet-v3-large-1.0-224-paddle` is one of MobileNets V3 - next generation of MobileNets,
6+
based on a combination of complementary search techniques as well as a novel architecture design.
7+
`mobilenet-v3-large-1.0-224-paddle` is pretrained in Paddle\* framework and targeted for high resource use cases.
8+
For details see [paper](https://arxiv.org/abs/1905.02244) and [repository](https://github.com/PaddlePaddle/PaddleClas).
9+
10+
## Specification
11+
12+
| Metric | Value |
13+
|---------------------------------|-------------------------------------------|
14+
| Type | Classification |
15+
| GFlops | 0.4565 |
16+
| MParams | 5.468 |
17+
| Source framework | Paddle\* |
18+
19+
## Accuracy
20+
21+
| Metric | Result |
22+
| ------ | -------------- |
23+
| Top 1 | 75.248% |
24+
| Top 5 | 92.32% |
25+
26+
## Input
27+
28+
### Original Model
29+
30+
Image, name: `x`, shape: `1, 3, 224, 224`, format: `B, C, H, W`, where:
31+
32+
- `B` - batch size
33+
- `C` - number of channels
34+
- `H` - image height
35+
- `W` - image width
36+
37+
Expected color order: `RGB`.
38+
Mean values - [123.675,116.28,103.53], scale values - [58.395, 57.12, 57.375].
39+
40+
### Converted Model
41+
42+
Image, name: `x`, shape: `1, 3, 224, 224`, format: `B, C, H, W`, where:
43+
44+
- `B` - batch size
45+
- `C` - number of channels
46+
- `H` - image height
47+
- `W` - image width
48+
49+
Expected color order: `BGR`.
50+
51+
## Output
52+
53+
### Original Model
54+
55+
Object classifier according to ImageNet classes, name - `softmax_1.tmp_0`, shape - `1, 1000`, output data format is `B, C` where:
56+
57+
- `B` - batch size
58+
- `C` - predicted probabilities for each class in [0, 1] range
59+
60+
### Converted Model
61+
62+
The converted model has the same parameters as the original model.
63+
64+
## Download a Model and Convert it into OpenVINO™ IR Format
65+
66+
You can download models and if necessary convert them into OpenVINO™ IR format using the [Model Downloader and other automation tools](../../../tools/model_tools/README.md) as shown in the examples below.
67+
68+
An example of using the Model Downloader:
69+
```
70+
omz_downloader --name <model_name>
71+
```
72+
73+
An example of using the Model Converter:
74+
```
75+
omz_converter --name <model_name>
76+
```
77+
78+
## Demo usage
79+
80+
The model can be used in the following demos provided by the Open Model Zoo to show its capabilities:
81+
82+
* [Classification Benchmark C++ Demo](../../../demos/classification_benchmark_demo/cpp/README.md)
83+
* [Classification Python\* Demo](../../../demos/classification_demo/python/README.md)
84+
85+
## Legal Information
86+
87+
The original model is distributed under the
88+
[Apache License, Version 2.0](https://raw.githubusercontent.com/PaddlePaddle/PaddleClas/release/2.3/LICENSE).
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
models:
2+
- name: mobilenet-v3-large-1.0-224-paddle
3+
launchers:
4+
- framework: openvino
5+
adapter: classification
6+
7+
datasets:
8+
- name: imagenet_1000_classes
9+
preprocessing:
10+
- type: resize
11+
size: 256
12+
aspect_ratio_scale: greater
13+
- type: crop
14+
size: 224
15+
16+
metrics:
17+
- name: accuracy@top1
18+
type: accuracy
19+
top_k: 1
20+
reference: 0.75248
21+
- name: accuracy@top5
22+
type: accuracy
23+
top_k: 5
24+
reference: 0.9232
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright (c) 2022 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
description: >-
16+
"mobilenet-v3-large-1.0-224-paddle" is one of MobileNets V3 - next generation of MobileNets,
17+
based on a combination of complementary search techniques as well as a novel architecture
18+
design. "mobilenet-v3-large-1.0-224-paddle" is pretraind in Paddle framework and targeted for low resource use cases.
19+
For details see paper <https://arxiv.org/abs/1905.02244> and repository <https://github.com/PaddlePaddle/PaddleClas>.
20+
task_type: classification
21+
files:
22+
- name: paddleclas-2.2.1-py3-none-any.whl
23+
size: 306598
24+
checksum: 16b0ea3a97393b17e40c657fce1b83ef78a8accef34e721cf6691151da1730efdbc7018635053636a023a2ca5abb3e4b
25+
source: https://files.pythonhosted.org/packages/ba/2d/7e76250b345157c60639e9bbb301a39f1796cf882ac887a082245e54fa7d/paddleclas-2.2.1-py3-none-any.whl
26+
- name: MobileNetV3_large_x1_0_pretrained.pdparams
27+
size: 33273297
28+
checksum: 4b5f60288b6b4e8a394c2c7b8e6aaaa17d02ab3541ce4589268626a2ec78beb5deeccc956c16b602412e7d687d2b2327
29+
original_source: https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/MobileNetV3_large_x1_0_pretrained.pdparams
30+
source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2022.2/mobilenet-v3-large-1.0-224-paddle/MobileNetV3_large_x1_0_pretrained.pdparams
31+
- name: tools/export_model.py
32+
size: 3635
33+
checksum: cf7563115a0ec676d989525500f67dc30dd52f6d7771ffe91e58538fed9479a9a134bb1168311ea71fe0bf29b739c561
34+
source: https://raw.githubusercontent.com/PaddlePaddle/PaddleClas/7c1f291b88914a862b824393ba00d8f54269a73e/tools/export_model.py
35+
- name: MobileNetV3_large_x1_0.yaml
36+
size: 2768
37+
checksum: 3d7e066070fafdb3f01d49b3b6f422b96d93cf895dff89017accc583b034ad72be2c042e0db88fecee4d57fa74f4ba1f
38+
source: https://raw.githubusercontent.com/PaddlePaddle/PaddleClas/d6d5efe055caa9e08d0c392fcc02b49319afe14a/ppcls/configs/ImageNet/MobileNetV3/MobileNetV3_large_x1_0.yaml
39+
postprocessing:
40+
- $type: unpack_archive
41+
format: zip
42+
file: paddleclas-2.2.1-py3-none-any.whl
43+
- $type: regex_replace
44+
file: tools/export_model.py
45+
pattern: sys.path.append\(os.path.abspath\(os.path.join\(__dir__, '..\/'\)\)\)
46+
replacement: sys.path.append(os.path.abspath(os.path.join(__dir__, '../paddleclas')))
47+
input_info:
48+
- name: x
49+
shape: [1, 3, 224, 224]
50+
layout: NCHW
51+
model_optimizer_args:
52+
- --reverse_input_channels
53+
- --scale_values=[58.395, 57.12, 57.375]
54+
- --mean_values=[123.675, 116.28, 103.53]
55+
- --output=softmax_1.tmp_0
56+
- --input_model=$conv_dir/inference_model/inference.pdmodel
57+
framework: paddle
58+
license: https://raw.githubusercontent.com/PaddlePaddle/PaddleClas/release/2.3/LICENSE
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python3
2+
3+
# Copyright (c) 2022 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
import argparse
18+
import subprocess # nosec - disable B404:import-subprocess check
19+
import sys
20+
21+
from pathlib import Path
22+
23+
24+
def main():
25+
parser = argparse.ArgumentParser()
26+
parser.add_argument('input_dir', type=Path)
27+
parser.add_argument('output_dir', type=Path)
28+
args = parser.parse_args()
29+
30+
subprocess.run([sys.executable, '--',
31+
str(args.input_dir / 'tools' / 'export_model.py'), '-c',
32+
str(args.input_dir / 'MobileNetV3_large_x1_0.yaml'), '-o',
33+
f"Global.pretrained_model={args.input_dir/ 'MobileNetV3_large_x1_0_pretrained'}",
34+
'-o', f"Global.save_inference_dir={args.output_dir / 'inference_model'}",
35+
'-o', 'Global.device=cpu'
36+
], check=True)
37+
38+
39+
if __name__ == '__main__':
40+
main()

0 commit comments

Comments
 (0)