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

convert onnx to xml bin. it show me that Concat input shapes do not match.

zhong12
Beginner
1,445 Views
lass TemporalShift(nn.Module): def __init__(self, net, n_segment=3, n_div=8, fold=8): super(TemporalShift, self).__init__() self.net = net self.n_segment = n_segment self.fold_div = n_div self.fold=fold   def forward(self, x): x = shift(x, self.fold) out = self.net(x) return out     def shift(x, fold): n_segment = 10 fold_div = 8 nt, c, h, w = x.size()   n_batch = 1 x = x.view(n_batch, n_segment, c, h, w)   left_side = torch.cat((x[:, 1:, :fold], torch.zeros(1, 1, fold, h, w)), dim=1) right_side = torch.cat((torch.zeros(1, 1, fold, h, w), x[:, :-1, fold: 2 * fold]), dim=1) out = torch.cat((left_side, right_side, x[:, :, 2 * fold:]), dim=2)   return out.view(-1, c, h, w)

it is my code snippet about a custom layer above. the input parameter net was a normal convolution network. my openvino version is openvino_2020.2.120. when I try to convert . it show me that

(py36_env) zhx3@ubuntu:/opt/intel/openvino/deployment_tools/model_optimizer$ sudo python3 mo_onnx.py \ > --input_model tsm_resnet50.onnx \ > --input "input" \ > --input_shape [10,3,224,224] \ > --mean_values [0.4850,0.4560,0.4060] \ > --scale_values [0.2290,0.2240,0.2250] Model Optimizer arguments: Common parameters: - Path to the Input Model: /opt/intel/openvino_2020.2.120/deployment_tools/model_optimizer/tsm_resnet50.onnx - Path for generated IR: /opt/intel/openvino_2020.2.120/deployment_tools/model_optimizer/. - IR output name: tsm_resnet50 - Log level: ERROR - Batch: Not specified, inherited from the model - Input layers: input - Output layers: Not specified, inherited from the model - Input shapes: [10,3,224,224] - Mean values: [0.4850,0.4560,0.4060] - Scale values: [0.2290,0.2240,0.2250] - 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 ONNX specific parameters: Model Optimizer version: 2020.2.0-60-g0bc66e26ff [ ERROR ] Concat input shapes do not match [ ERROR ] Shape is not defined for output 0 of "390". [ ERROR ] Cannot infer shapes or values for node "390". [ ERROR ] Not all output shapes were inferred or fully defined for node "390". For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. [ ERROR ] [ ERROR ] It can happen due to bug in custom shape infer function <function concat_infer at 0x7f8b2040ad08>. [ ERROR ] Or because the node inputs have incorrect values/shapes. [ ERROR ] Or because input shapes are incorrect (embedded to the model or passed via --input_shape). [ ERROR ] Run Model Optimizer with --log_level=DEBUG for more information. [ ERROR ] Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Stopped shape/value propagation at "390" node. For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38.[ 2020-06-15 17:39:40,433 ] [ DEBUG ] [ infer:144 ] Outputs: [ 2020-06-15 17:39:40,433 ] [ DEBUG ] [ infer:31 ] output[0]: shape = [ 1 10 8 56 56], value = <UNKNOWN> [ 2020-06-15 17:39:40,434 ] [ DEBUG ] [ infer:128 ] -------------------- [ 2020-06-15 17:39:40,434 ] [ DEBUG ] [ infer:129 ] Partial infer for 390 [ 2020-06-15 17:39:40,434 ] [ DEBUG ] [ infer:130 ] Op: Concat [ 2020-06-15 17:39:40,434 ] [ DEBUG ] [ infer:131 ] Inputs: [ 2020-06-15 17:39:40,434 ] [ DEBUG ] [ infer:31 ] input[0]: shape = [ 1 10 8 56 56], value = <UNKNOWN> [ 2020-06-15 17:39:40,434 ] [ DEBUG ] [ infer:31 ] input[1]: shape = [ 1 2 8 56 56], value = <UNKNOWN> [ 2020-06-15 17:39:40,434 ] [ DEBUG ] [ infer:31 ] input[2]: shape = [ 1 10 48 56 56], value = <UNKNOWN> [ ERROR ] Concat input shapes do not match [ 2020-06-15 17:39:40,435 ] [ DEBUG ] [ infer:144 ] Outputs: [ 2020-06-15 17:39:40,435 ] [ DEBUG ] [ infer:31 ] output[0]: shape = <UNKNOWN>, value = <UNKNOWN> [ ERROR ] Shape is not defined for output 0 of "390". [ ERROR ] Cannot infer shapes or values for node "390". [ ERROR ] Not all output shapes were inferred or fully defined for node "390". For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40.

above is my part log file.

 

0 Kudos
2 Replies
zhong12
Beginner
1,410 Views

I have solve the problem. because the openvino may not know the python idx -1 such as the x[:, :- 1, fold: 2 * fold] the :- 1 slice will get wrong shape

0 Kudos
JAVIERJOSE_A_Intel
1,410 Views

Hi zhong12,

 

We are glad to hear you solved your issue. Thanks for sharing your solution with the community!

 

Regards,

 

Javier A.

0 Kudos
Reply