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.
6480 Discussions

Model Optimizer fails to convert MXNet model when NetworkX 2.4 is installed

Moiseev__Nikita
Beginner
1,203 Views

Hi,
Looks like Model Optimizer does not work out-of-the-box on Ubuntu 18.04 (and 16.04) anymore.
I am using the following Dockerfile (almost identical copy of one from https://docs.openvinotoolkit.org/2019_R1.1/_docs_install_guides_installing_openvino_docker.html)

###########################################################################

FROM ubuntu:18.04

ARG DOWNLOAD_LINK=http://registrationcenter-download.intel.com/akdlm/irc_nas/15944/l_openvino_toolkit_p_2019.3.334.tgz
ARG INSTALL_DIR=/opt/intel/openvino
ARG TEMP_DIR=/tmp/openvino_installer
RUN apt-get update && apt-get install -y --no-install-recommends \
    wget \
    cpio \
    sudo \
    lsb-release && \
    rm -rf /var/lib/apt/lists/*
RUN mkdir -p "$TEMP_DIR" && cd "$TEMP_DIR" && \
    wget -c "$DOWNLOAD_LINK" && \
    tar xf l_openvino_toolkit*.tgz && \
    rm l_openvino_toolkit*.tgz && \
    cd l_openvino_toolkit* && \
    sed -i 's/decline/accept/g' silent.cfg && \
    ./install.sh -s silent.cfg && \
    cd && \
    rm -rf "$TEMP_DIR"
RUN "$INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh"
RUN cd /opt/intel/openvino/deployment_tools/model_optimizer/install_prerequisites \
    && ./install_prerequisites_mxnet.sh

###########################################################################
Until recently everything was OK, but now I get the following error message:

###########################################################################

Model Optimizer version:     2019.3.0-375-g332562022
[ ERROR ]  -------------------------------------------------
[ ERROR ]  ----------------- INTERNAL ERROR ----------------
[ ERROR ]  Unexpected exception happened.
[ ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  'Graph' object has no attribute 'node'
[ ERROR ]  Traceback (most recent call last):
  File "/opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/mo/main.py", line 302, in main
    return driver(argv)
  File "/opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/mo/main.py", line 267, in driver
    ret_res = mo_mxnet.driver(argv, argv.input_model, model_name, argv.output_dir)
  File "/opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/mo/pipeline/mx.py", line 75, in driver
    graph = symbol2nx(model_nodes, model_params, argv.input)
  File "/opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/mo/front/mxnet/loader.py", line 112, in symbol2nx
    graph.add_node(node_name, **symbol_attrs(node))
  File "/opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/mo/graph/graph.py", line 505, in add_node
    node.update_node()
  File "/opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/mo/graph/graph.py", line 470, in update_node
    in_ports_count = self.in_ports_count if self.has_valid('in_ports_count') else None
  File "/opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/mo/graph/graph.py", line 161, in has_valid
    return self.has(k) and not self.graph.node[self.node] is None
  File "/opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/mo/graph/graph.py", line 158, in has
    return k in self.graph.node[self.node]
AttributeError: 'Graph' object has no attribute 'node'

[ ERROR ]  ---------------- END OF BUG REPORT --------------
[ ERROR ]  -------------------------------------------------
###########################################################################

It seems like the problem is with NetworkX python package version 2.4. It is the latest currently available version which will be installed on Ubuntu via apt (which, I suppose, is called somewhere inside install_prerequisites_mxnet.sh script).
The problem is resolved by installing NetworkX version 2.3.

I guess, install_prerequisites_mxnet.sh needs some correction.

Thanks.

0 Kudos
2 Replies
Moiseev__Nikita
Beginner
1,203 Views
0 Kudos
Anna_B_Intel
Employee
1,203 Views

Hi Nikita, 

The issue is already fixed (now NetworkX 2.4 is supported) and will be a part of next release (OpenVINO 2019 R4).  

The fix is the following change in model_optimizer/mo/graph/graph.py:

        self.strict_mode = True
        super().__init__(data, **attr)

+        if not hasattr(self, 'node'):
+             self.node = self.nodes
+
    unique_id_count = 0

Let me know if it works for you.

 

Best wishes, 

Anna

 

0 Kudos
Reply