openvinotoolkit / openvino

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

[Bug] Requested output shape {1,64,29} is incompatible with input shape {560, 29} #8612

Closed awsomecod closed 2 years ago

awsomecod commented 2 years ago
downloader.py --name quartznet-15x5-en

converter.py --name quartznet-15x5-en

python3  speech_recognition_quartznet_demo.py -m public/quartznet-15x5-en/FP32/quartznet-15x5-en.xml  -i f2bjrop1.0.wav 

The output is

  import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
Traceback (most recent call last):
  File "speech_recognition_quartznet_demo.py", line 124, in <module>
    main()
  File "speech_recognition_quartznet_demo.py", line 118, in main
    quartz_net = QuartzNet(IECore(), args.model, log_melspectrum.shape, args.device)
  File "speech_recognition_quartznet_demo.py", line 59, in __init__
    network.reshape({next(iter(network.input_info)): input_shape})
  File "ie_api.pyx", line 1480, in openvino.inference_engine.ie_api.IENetwork.reshape
RuntimeError: Check 'backward_compatible_check || in_out_elements_equal' failed at core/src/op/reshape.cpp:328:
While validating node 'v1::Reshape output (LogSoftmax_266/LogSoftmax_[0]:f32{560,29}, 1288[0]:i64{3}) -> (f32{?,?,?})' with friendly_name 'output':
Requested output shape {1,64,29} is incompatible with input shape {560, 29}
zulkifli-halim commented 2 years ago

Hi @awsomecod please share with us your setup environment. I was able to run the speech_recognition_quartznet_demo.py using these two platforms: Windows 10 - OpenVINO 2021.4.582 Ubuntu 18.04 - OpenVINO 2021.4.689

image

awsomecod commented 2 years ago

Hi @zulkifli-halim

Openvino 2021.4.1 LTS

Ubuntu 20.04

I just tried again and receive the same error.

awsomecod commented 2 years ago

@zulkifli-halim

I build openvino from the source code. I built from 2021.4.1 LTS release. Would you please guide me which release should I build from to make speech_recognition_quartznet_demo.py work?

zulkifli-halim commented 2 years ago

@awsomecod the quartznet-15x5-en model is only available from 2021.4 onwards. I replicate from my side by using Ubuntu 20.4 and received a similar error as you. I will share this output with the dev team to take a look.

Our suggestion, for now, try to use Ubuntu 18.04 to run the demo.

awsomecod commented 2 years ago

@zulkifli-halim ok, I will try on Ubuntu 18.04.

awsomecod commented 2 years ago

My GPU is UHD 750 and openvino does not run on this GPU with Ubuntu 18.04 (link). I have to use Ubuntu 20.04. It would be great if you can make quartznet-15x5-en work on Ubuntu 20.04 as well.

jgespino commented 2 years ago

Hi @awsomecod

You mentioned you build OpenVINO from source using 2021.4.1 LTS branch. When you downloaded the model, are you downloading from the Open Model Zoo branch 2021.4.1? You need to use the same version on both OpenVINO and Open Model Zoo to ensure compatibility.

https://github.com/openvinotoolkit/open_model_zoo/tree/2021.4.1/models/public/quartznet-15x5-en

Regards, Jesus

awsomecod commented 2 years ago

The version of open model zoo is 2021.4 as can be seen from READ.ME file inside open_model_zoo directory.

I downloaded the openvino and open_model_zoo by using the following commands:

git clone https://github.com/openvinotoolkit/openvino

git clone https://github.com/openvinotoolkit/open_model_zoo.git

So I guess there shouldn't be any compatibility issue.

jgespino commented 2 years ago

Hi @awsomecod

I just tested using the master branch of both openvino and open_model_zoo. Sample worked as expected.

This is how I built OpenVINO:

git clone https://github.com/openvinotoolkit/openvino
cd openvino/
git submodule update --init --recursive
mkdir build
cd build/
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so -DPYTHON_INCLUDE_DIR=/usr/include/python3.6 ..
make --jobs=$(nproc --all)
export PYTHONPATH=$PYTHONPATH:~/openvino/bin/intel64/Release/lib/python_api/python3.6/

Clone open_model_zoo and ran demo

git clone https://github.com/openvinotoolkit/open_model_zoo
cd open_model_zoo/demos/speech_recognition_quartznet_demo/
omz_downloader --list models.lst 
omz_converter --list models.lst 
python3 speech_recognition_quartznet_demo.py --model public/quartznet-15x5-en/FP16/quartznet-15x5-en.xml --input ~/Downloads/f2bjrop1.0.wav 

Regards, Jesus

awsomecod commented 2 years ago

I executed the same commands but still receive an error. I use python3.8 instead of python3.6. Could it be the source of issue?

jgespino commented 2 years ago

@awsomecod That may be it, I was testing with the default Python3 version installed on Ubuntu 18.04.

jgespino commented 2 years ago

Closing, please re-open if additional assistance is needed.

YIN-jd commented 2 months ago

hello, i have a problem. when i use openvino.convert_model() function to convert keras model,i have a error. the error is: RuntimeError: Check 'backward_compatible_check || in_out_elements_equal' failed at src/core/shape_inference/include\reshape_shape_inference.hpp:357: While validating node 'opset1::Reshape model_4/dense_9/Tensordot/Reshape (opset1::Transpose model_4/dense_9/fake_quantize_I0/SymmQuant/FakeQuantWithMinMaxVars[0]:dynamic[], opset1::Constant model_4/dense_9/Tensordot/Reshape/shape[0]:i32[2]) -> (dynamic[32,128])' with friendly_name 'model_4/dense_9/Tensordot/Reshape': Shape inference input shapes {[],[2]} Requested output shape [32,128] is incompatible with input shape.

So, how to solve this problem?