- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I try to use model_optimizer to convert a tf model file xxx.pb to IR, there is always error log in 'ExpandDims':
My node of "ExpandDims" description in 'pbtxt' is below: node { name: "ExpandDims" op: "ExpandDims" input: "sub" input: "ExpandDims/dim" attr { key: "T" value { type: DT_FLOAT } } attr { key: "value" value { tensor { dtype: DT_FLOAT tensor_shape { } } } } attr { key: "Tdim" value { type: DT_INT32 } } }
Actually I found there are several similar threads on this node, and I have tried to add '--input_shape [1, 480, 640, 3]' and '--input ExpandDims' but no use for my case. Then I started to investigate python code in model_optimizer/mo/front/common/partial_infer/expand_dims.py below:
import logging as log import numpy as np def tf_expand_dims_infer(node): input_shape = node.in_nodes()[0] axis = node.in_nodes()[1] output = node.out_node() if input_shape.value is None or axis.value is None: return if isinstance(axis.value, np.ndarray) and axis.value.size > 1: log.error("ExpandDims operation : axis should be scalar") return if len(input_shape.shape) == 0: output.value = input_shape.value.copy() else: output.value = np.insert(input_shape.value, axis.value[0], 1) output.shape = np.array(output.value.shape, dtype=np.int64)
The problem starts from input_shape.value, which is not defined since the value is inherited from the node's first input. So the first 'return' code will be executed. Even though I commented it and let the function runs to the end of the function, the output.value must use input_shape.value too in np.insert(), where the code still gaps into error.
I'm not quite sure if this is the root cause, but I wish to find a workaround to let the MO finish its execution.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dahan,
Do you mind providing me the frozen .pb file that you are using so that I can reproduce the results?
Kind Regards,
Monique Jones
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jones,
I've share the compressed model file at https://drive.google.com/open?id=1jrbKtXQkN6A-7Tq0eI_72EH74R0NTqVd .
Could you please help to try mo on it?
Best Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dahan,
I will reproduce your issue today and see what we can do to resolve it.
Kind Regards,
Monique Jones
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page