Skip to content

Commit 52ad786

Browse files
authored
Add convert GluonCV docs (openvinotoolkit#1413)
* Add convert GluonCV docs
1 parent c8d7463 commit 52ad786

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

docs/MO_DG/prepare_model/convert_model/Convert_Model_From_MxNet.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ A summary of the steps for optimizing and deploying a model that was trained wit
3838

3939
**Other supported topologies**
4040

41-
* Style transfer [model](https://github.com/zhaw/neural_style) can be converted using [instruction](mxnet_specific/Convert_Style_Transfer_From_MXNet.md),
41+
* [GluonCV SSD and YOLO-v3 models](https://gluon-cv.mxnet.io/model_zoo/detection.html) can be converted using the following [instructions](mxnet_specific/Convert_GluonCV_Models.md).
42+
* [Style transfer model](https://github.com/zhaw/neural_style) can be converted using the following [instructions](mxnet_specific/Convert_Style_Transfer_From_MXNet.md).
4243

4344
## Convert an MXNet* Model <a name="ConvertMxNet"></a>
4445

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Converting GluonCV* Models {#openvino_docs_MO_DG_prepare_model_convert_model_mxnet_specific_Convert_GluonCV_Models}
2+
3+
This document provides the instructions and examples on how to use Model Optimizer to convert [GluonCV SSD and YOLO-v3 models](https://gluon-cv.mxnet.io/model_zoo/detection.html) to IR.
4+
5+
1. Choose the topology available from the [GluonCV Moodel Zoo](https://gluon-cv.mxnet.io/model_zoo/detection.html) and export to the MXNet format using the GluonCV API. For example, for the `ssd_512_mobilenet1.0` topology:
6+
```python
7+
from gluoncv import model_zoo, data, utils
8+
from gluoncv.utils import export_block
9+
net = model_zoo.get_model('ssd_512_mobilenet1.0_voc', pretrained=True)
10+
export_block('ssd_512_mobilenet1.0_voc', net, preprocess=True, layout='HWC')
11+
```
12+
As a result, you will get an MXNet model representation in `ssd_512_mobilenet1.0.params` and `ssd_512_mobilenet1.0.json` files generated in the current directory.
13+
2. Run the Model Optimizer tool specifying the `--enable_ssd_gluoncv` option. Make sure the `--input_shape` parameter is set to the input shape layout of your model (NHWC or NCHW). The examples below illustrates running the Model Optimizer for the SSD and YOLO-v3 models trained with the NHWC layout and located in the `<model_directory>`:
14+
* **For GluonCV SSD topologies:**
15+
```sh
16+
python3 mo_mxnet.py --input_model <model_directory>/ssd_512_mobilenet1.0.params --enable_ssd_gluoncv --input_shape [1,512,512,3] --input data
17+
```
18+
* **For YOLO-v3 topology:**
19+
* To convert the model:
20+
```sh
21+
python3 mo_mxnet.py --input_model <model_directory>/yolo3_mobilenet1.0_voc-0000.params --input_shape [1,255,255,3]
22+
```
23+
* To convert the model with replacing the subgraph with RegionYolo layers:
24+
```sh
25+
python3 mo_mxnet.py --input_model <model_directory>/models/yolo3_mobilenet1.0_voc-0000.params --input_shape [1,255,255,3] --transformations_config "mo/extensions/front/mxnet/yolo_v3_mobilenet1_voc.json"
26+
```

docs/doxygen/ie_docs.xml

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
</tab>
6363
<tab type="usergroup" title="Converting a MXNet* Model" url="@ref openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_MxNet">
6464
<tab type="user" title="Converting a Style Transfer Model from MXNet" url="@ref openvino_docs_MO_DG_prepare_model_convert_model_mxnet_specific_Convert_Style_Transfer_From_MXNet"/>
65+
<tab type="user" title="Converting GluonCV* Models" url="@ref openvino_docs_MO_DG_prepare_model_convert_model_mxnet_specific_Convert_GluonCV_Models"/>
6566
</tab>
6667
<tab type="usergroup" title="Converting Your Kaldi* Model" url="@ref openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_Kaldi">
6768
<tab type="user" title="Convert Kaldi* ASpIRE Chain Time Delay Neural Network (TDNN) Model to the Intermediate Representation" url="@ref openvino_docs_MO_DG_prepare_model_convert_model_kaldi_specific_Aspire_Tdnn_Model"/>

0 commit comments

Comments
 (0)