Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6404 Discussions

Model Optimizer does not support minux numbers in the Reshape layer of MXNet

Yang__Boyu
Beginner
510 Views

Hi,

I encounter an error which says

[ ERROR ]  The attribute "shape" of the operation "reshape35" contains value "-3" which is not supported.

when I'm trying to convert a MXNet model. Does this mean that OpenVino doesn't support MXNet Reshape layer with those special minus parameters? Is there any method to solve this problem?

My Model Optimizer version is 2019.1.0-341-gc9b66a2. The command and complete output is shown below.

 

$ python3 mo.py --input_model ~/openvino_models/shuffle/base-50000.params --input_symbol ~/openvino_models/shuffle/base-symbol.json --output_dir ~/openvino_models/shuffle/ --input_shape [108,108]
Model Optimizer arguments:
Common parameters:
    - Path to the Input Model:     /home/user/openvino_models/shuffle/base-50000.params
    - Path for generated IR:     /home/user/openvino_models/shuffle/
    - IR output name:     base-50000
    - Log level:     ERROR
    - Batch:     Not specified, inherited from the model
    - Input layers:     Not specified, inherited from the model
    - Output layers:     Not specified, inherited from the model
    - Input shapes:     [108,108]
    - Mean values:     Not specified
    - Scale values:     Not specified
    - Scale factor:     Not specified
    - Precision of IR:     FP32
    - Enable fusing:     True
    - Enable grouped convolutions fusing:     True
    - Move mean values to preprocess section:     False
    - Reverse input channels:     False
MXNet specific parameters:
    - Deploy-ready symbol file:     /home/user/openvino_models/shuffle/base-symbol.json
    - Enable MXNet loader for models trained with MXNet version lower than 1.0.0:     False
    - Prefix name for args.nd and argx.nd files:     None
    - Pretrained model to be merged with the .nd files:     None
    - Enable saving built parameters file from .nd files:     False
Model Optimizer version:     2019.1.0-341-gc9b66a2
[ ERROR ]  The attribute "shape" of the operation "reshape35" contains value "-3" which is not supported.
[ ERROR ]  Unexpected exception happened during extracting attributes for node part_0_stage3_stage2_right_conv2_bias.
Original exception message: Model Optimizer does not support layer "reshape35". Please, implement extension.
 For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #45.

 

Thanks,

Boyu

0 Kudos
4 Replies
Shubha_R_Intel
Employee
510 Views

Dear Yang, Boyu,

From Model Optimizer's and Inference Engine's perspective, the input_shape has a form of [N,C,H,W]. If any of those values are negative, yes it's a problem for Model Optimizer. So to avoid such such errors, you can pass a fully qualified --input_shape with 4 values, where N = batch_size. Please make sure you choose from one of our Supported MXNet Topologies . Further please study the Supported Layers Doc, where you will see that Reshape is supported for MxNet but Reshape35 is missing from the list. But when I search the Internet for MxNet Reshape35 I don't see anything, I only see Reshape.

In any case, the Model Optimizer gives you a very succinct error:

Original exception message: Model Optimizer does not support layer "reshape35". Please, implement extension.

Reshape35 is not supported, as the aforementioned documentation also confirms. It's possible to support it however by writing a custom layer (even though I couldn't find specifications about Reshape35 anywhere on the Internet)

Hope it helps,

Thanks,

Shubha

 

0 Kudos
Yang__Boyu
Beginner
510 Views

Actually "reshape35" is only the name of one of the Reshape layers of MXNet in my model. The Model Optimizer will encounter the same problem in other Reshape layers of my model as well.

I changed the parameter of --input_shape to the form of [N,C,H,W] and the same problem still occurs.

The definition of "reshape35" layer is shown below.

    {
      "op": "Reshape",
      "name": "reshape35",
      "attrs": {"shape": "(0, -3, -2)"},
      "inputs": [[588, 0, 0]]
    }

 

Thanks,

Boyu

0 Kudos
Shubha_R_Intel
Employee
510 Views

Dearest Yang, Boyu,

Please kindly give me the entire exact MO command you used. Also where did you get your model ? Can you attach the model and the *.json ? Let me debug it.

Thanks,

Shubha

 

0 Kudos
Shubha_R_Intel
Employee
510 Views

Dear Boyu,

You are right about the minus numbers and Model Optimizer. While numpy improvises when it sees negative numbers Model Optimizer needs to have specific positive values for shape. "shape": "(0, -3, -2)" will not work for Model Optimizer. But it's curious to me that you'd have negative numbers there in the first place. Normally numpy can speculate about one dimension of input shape and this is usually represented by a -1 in one position but the other positions are positive values.

Hope it helps,

Thanks,

Shubha

 

0 Kudos
Reply