openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
7.26k stars 2.26k forks source link

[Bug] Model Optimizer InterpolateTranspose error #11490

Closed Noxi123 closed 2 years ago

Noxi123 commented 2 years ago
System information (version)
Detailed description

Hello, when using the new version of OpenVINO model optimizer I encountered a problem with network optimization, everything worked in version 2021.2 but not in higher versions. Model Optimizer returns the following error

[ ERROR ]  ----------------- INTERNAL ERROR ----------------
[ ERROR ]  Unexpected exception happened.
[ ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  Exception occurred during running replacer "None (<class 'openvino.tools.mo.front.tf.InterpolateTransposes.InterpolateTranspose'>)": 
[ ERROR ]  Traceback (most recent call last):
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\utils\class_registration.py", line 278, in apply_transform
    for_graph_and_each_sub_graph_recursively(graph, replacer.find_and_replace_pattern)
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\middle\pattern_match.py", line 46, in for_graph_and_each_sub_graph_recursively
    func(graph)
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\front\common\replacement.py", line 136, in find_and_replace_pattern
    apply_pattern(graph, action=self.replace_sub_graph, **self.pattern())
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\middle\pattern_match.py", line 83, in apply_pattern
    action(graph, match)
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\front\tf\InterpolateTransposes.py", line 61, in replace_sub_graph
    axes = Interpolate.get_axes(interpolate)
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\ops\interpolate.py", line 166, in get_axes
    assert src_shape is not None
AssertionError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\main.py", line 533, in main
    ret_code = driver(argv)
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\main.py", line 489, in driver
    graph, ngraph_function = prepare_ir(argv)
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\main.py", line 407, in prepare_ir
    graph = unified_pipeline(argv)
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\pipeline\unified.py", line 13, in unified_pipeline
    class_registration.apply_replacements(graph, [
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\utils\class_registration.py", line 328, in apply_replacements
    apply_replacements_list(graph, replacers_order)
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\utils\class_registration.py", line 314, in apply_replacements_list
    apply_transform(
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\utils\logger.py", line 112, in wrapper
    function(*args, **kwargs)
  File "D:\py_projects\openvino_new_version\venv\lib\site-packages\openvino\tools\mo\utils\class_registration.py", line 302, in apply_transform
    raise Exception('Exception occurred during running replacer "{} ({})": {}'.format(
Exception: Exception occurred during running replacer "None (<class 'openvino.tools.mo.front.tf.InterpolateTransposes.InterpolateTranspose'>)": 

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

it sets this in the InterpolateTransposes.py line 61 where the change was made in the newer versions from 2021.3 there is an added call to the function Interpolate.get_axes

       axes = Interpolate.get_axes(interpolate)
       if axes is None or not np.array_equal(axes, int64_array([1, 2])): 
            return

and in this function it sets the problem when you call get_axes(...), in file Interpolate.py at line 165 is src_shape = node.in_port(0).data.get_shape() followed by an assert and raises the given error.

Steps to reproduce

Here is net test.zip and parameters with which I executed it

python .../openvino/tools/mo/mo_tf.py
--input_model
test.pb
--input_shape
[1,32,224,1]
--log_level
DEBUG
--output
"ocr_out"
--input
"input_data"
--data_type
FP32
--disable_nhwc_to_nchw
Issue submission checklist
Iffa-Intel commented 2 years ago

@Noxi123 ,

I've checked your model with both older (2021.1) version and latest (2022.1) version. I could observe the same result as yours.

The conversion succeed in the older OV version

mo_20211

while failed in the latest OV version

mo20221Error

We'll further investigate this and get back to you asap.

Noxi123 commented 2 years ago

Thank you very much, I'll wait for your reply.

jgespino commented 2 years ago

@Noxi123 We were not able to find a solution for converting your model using OpenVINO 2022.1 release. We have submitted an internal ticket with the development team to investigate.

Ref. 84180

Noxi123 commented 2 years ago

Thank you very much I appreciate it, for now I will use the older version.

svetozarko commented 2 years ago

Hi, Any update on this issue?

Thanks.

jgespino commented 2 years ago

@svetom This is something the development team is still looking into. I appologies for hte delay.

jane-intel commented 2 years ago

@Noxi123 and @svetom the fix was merged -- your models should now be converted to IR. To try it out please checkout latest master. Thank you!