Converting a MXNet* Model

A summary of the steps for optimizing and deploying a model that was trained with the MXNet* framework:

  1. Configure the Model Optimizer for MXNet* (MXNet was used to train your model)
  2. Convert a MXNet model to produce an optimized Intermediate Representation (IR) of the model based on the trained network topology, weights, and biases values
  3. Test the model in the Intermediate Representation format using the Inference Engine in the target environment via provided Inference Engine sample applications
  4. Integrate the Inference Engine in your application to deploy the model in the target environment

Supported Topologies

Model NameModel File
VGG-16Repo, Symbol, Params
VGG-19Repo, Symbol, Params
ResNet-152 v1Repo, Symbol, Params
SqueezeNet_v1.1Repo, Symbol, Params
Inception BNRepo, Symbol, Params
CaffeNetRepo, Symbol, Params
DenseNet-121Repo, Symbol, Params
DenseNet-161Repo, Symbol, Params
DenseNet-169Repo, Symbol, Params
DenseNet-201Repo, Symbol, Params
MobileNetRepo, Symbol, Params
SSD-ResNet-50Repo, Symbol + Params
SSD-VGG-16-300Repo, Symbol + Params
SSD-Inception v3Repo, Symbol + Params
FCN8 (Semantic Segmentation)Repo, Symbol, Params
MTCNN part 1 (Face Detection)Repo, Symbol, Params
MTCNN part 2 (Face Detection)Repo, Symbol, Params
MTCNN part 3 (Face Detection)Repo, Symbol, Params
MTCNN part 4 (Face Detection)Repo, Symbol, Params
Lightened_moonRepo, Symbol, Params

Other supported topologies

Convert an MXNet* Model

To convert an MXNet* model:

  1. Go to the <INSTALL_DIR>/deployment_tools/model_optimizer directory.
  2. To convert an MXNet* model contained in a model-file-symbol.json and model-file-0000.params, run the Model Optimizer launch script, specifying a path to the input model file:
    python3 --input_model model-file-0000.params

Two groups of parameters are available to convert your model:

Using MXNet*-Specific Conversion Parameters

The following list provides the MXNet*-specific parameters.

MXNet-specific parameters:
--input_symbol <SYMBOL_FILE_NAME>
Symbol file (for example, "model-symbol.json") that contains a topology structure and layer attributes
--nd_prefix_name <ND_PREFIX_NAME>
Prefix name for args.nd and argx.nd files
--pretrained_model_name <PRETRAINED_MODEL_NAME>
Name of a pretrained MXNet model without extension and epoch
number. This model will be merged with args.nd and argx.nd
Enable saving built parameters file from .nd files
Enable MXNet loader to make a model compatible with the latest MXNet version.
Use only if your model was trained with MXNet version lower than 1.0.0
Enable transformation for converting the gluoncv ssd topologies.
Use only if your topology is one of ssd gluoncv topologies

NOTE: By default, the Model Optimizer does not use the MXNet loader, as it transforms the topology to another format, which is compatible with the latest version of MXNet, but it is required for models trained with lower version of MXNet. If your model was trained with MXNet version lower than 1.0.0, specify the --legacy_mxnet_model key to enable the MXNet loader. However, the loader does not support models with custom layers. In this case, you must manually recompile MXNet with custom layers and install it to your environment.

Custom Layer Definition

Internally, when you run the Model Optimizer, it loads the model, goes through the topology, and tries to find each layer type in a list of known layers. Custom layers are layers that are not included in the list of known layers. If your topology contains any layers that are not in this list of known layers, the Model Optimizer classifies them as custom.

Supported MXNet* Layers

Refer to Supported Framework Layers for the list of supported standard layers.

Frequently Asked Questions (FAQ)

The Model Optimizer provides explanatory messages if it is unable to run to completion due to issues like typographical errors, incorrectly used options, or other issues. The message describes the potential cause of the problem and gives a link to the Model Optimizer FAQ. The FAQ has instructions on how to resolve most issues. The FAQ also includes links to relevant sections in the Model Optimizer Developer Guide to help you understand what went wrong.


In this document, you learned: