Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenVINO 2020.1 doesn't work on Raspberry Pi and NCS2 #411

Closed
tgonzalez89 opened this issue Mar 8, 2020 · 51 comments
Closed

OpenVINO 2020.1 doesn't work on Raspberry Pi and NCS2 #411

tgonzalez89 opened this issue Mar 8, 2020 · 51 comments
Labels
bug Something isn't working category: Core OpenVINO Core (aka ngraph)

Comments

@tgonzalez89
Copy link

OpenVINO 2020.1 simply refuses to work when using the NCS2 in a Raspberry Pi. I'm seeing the error below. I have tested multiple sample applications using both C++ and Python and all give the same error.

./build/simple_classifier_cpp googlenet-v1.xml ../../data/images/nps_electric_guitar.png ../../data/ilsvrc12/synset_labels.txt
terminate called after throwing an instance of 'InferenceEngine::details::InferenceEngineException'
  what():  Check 'axis < static_cast<size_t>(input_rank)' failed at /teamcity/work/scoring_engine_build/releases_2020_1/ngraph/src/ngraph/op/gather.cpp:140:
While validating node 'Gather[Gather_589](patternLabel_585: float{10,20,30}, patternLabel_586: int64_t{5}, patternLabel_588: int64_t{1}) -> (??)':
The axis must => 0 and <= input_rank (axis: 4294967295).
@ArtemSkrebkov
Copy link

ArtemSkrebkov commented Mar 8, 2020

Is it possible to share the model you have tried to run?

@maxlytkin
Copy link

Hello @tgonzalez89
This is being considered as a bug and we expect it to be fixed in the next software release.
In the meantime we recommend:
Option 1: Use the previous pre-trained models from the 2019 R3 open model zoo - https://download.01.org/opencv/2019/open_model_zoo/R3/20190905_163000_models_bin/
Option 2: Generate the IRv7 using the model optimizer from the full installation of OpenVINO toolkit with the switch --generate_deprecated_IR_V7

Best regards, Max.

@natxopedreira
Copy link

@maxl16
How can we do Option 2 with a ready converted model like this one?
https://download.01.org/opencv/2020/openvinotoolkit/2020.3/open_model_zoo/models_bin/1/face-detection-0100/FP16/

@maxlytkin
Copy link

Hi @natxopedreira
Since this is already converted IR model, you should either go with Option 1 or try the latest Inference Engine version from latest available OpenVINO toolkit build.

@natxopedreira
Copy link

Thanks @maxl16

Latest one is the same as mentioned in this issue, i think... i tried but not work and im using 2019 models but in 2020 there are more face models that want to try but i do not find a way of do it?

Will they work on opencv?

Do you know when is going to be release a 2020 compatible version on rpi??

Thank you

@maxlytkin
Copy link

@natxopedreira
Have you tried to run Open Model Zoo as well as l_openvino_toolkit_runtime_raspbian_p_2020.2.120 as Inference Engine from the same OpenVINO open source 2020.2 build from here https://download.01.org/opencv/2020/openvinotoolkit/2020.2/
Unfortunately, currently I don't have a chance to test it, but I expect that should work.

@natxopedreira
Copy link

@maxl16
Thanks, im not 100% sure to have tested that combination but i will say that didn't work.

But to be sure i will test and post here the results, as a reference

Recentky i tried compiling opencv last version from source but also do not work :(

@natxopedreira
Copy link

@maxl16

Thank you so much!!!!!! seems to work, did a fast test.... i didn't try all the models but i was able to load this one
https://download.01.org/opencv/2020/openvinotoolkit/2020.2/open_model_zoo/models_bin/3/face-detection-0100/FP16/

But this instead trows error, do you know why? maybe int8 models do not work?
https://download.01.org/opencv/2020/openvinotoolkit/2020.2/open_model_zoo/models_bin/3/face-detection-0100/FP16-INT8/

terminate called after throwing an instance of 'InferenceEngine::details::InferenceEngineException'
  what():  Check 'input_shape_product.get_length() == shape_size(m_output_shape)' failed at /teamcity/work/scoring_engine_build/releases_2020_2/ngraph/src/ngraph/op/reshape.cpp:100:
While validating node 'v0::Reshape Reshape_36981(PriorBoxClustered_36323[0]:f32{2,4023193856}) -> (dynamic?)':
Product of output shape dimensions does not match product of argument shape dimensions (output shape: Shape{1, 2, 4023193856}, argument shape: {2,4023193856}).

@maxlytkin
Copy link

@natxopedreira
Glad that you were able to make this work.
For INT8 models inference CPU should meet some requirements from here https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Int8Inference.html
And I believe Raspberry Pi ARM processor does not fit this.

@natxopedreira
Copy link

@maxl16
Ok, that explains it.
Do you know what is the difference between those, i see folder: 1-2-3
https://download.01.org/opencv/2020/openvinotoolkit/2020.2/open_model_zoo/models_bin/

I assume that lastest folder is the best one? i mean models from folder 3

@natxopedreira
Copy link

@maxl16

I tried full script, previous i tried directly on console and i dont know why dont trow an error...

executing this code
`
model_face_bin = 'models/face-detection-adas-0001/face-detection-adas-0001.bin'
model_face_xml = 'models/face-detection-adas-0001/face-detection-adas-0001.xml'

net = cv.dnn.readNet(model_face_xml,model_face_bin)
`

Model downloaded from this
https://download.01.org/opencv/2020/openvinotoolkit/2020.2/open_model_zoo/models_bin/3/face-detection-adas-0001/FP16/

trows this error

terminate called after throwing an instance of 'InferenceEngine::details::InferenceEngineException' what(): Check 'input_shape_product.get_length() == shape_size(m_output_shape)' failed at /teamcity/work/scoring_engine_build/releases_2020_2/ngraph/src/ngraph/op/reshape.cpp:100: While validating node 'v0::Reshape Reshape_971(PriorBox_744[0]:f32{2,3888336896}) -> (dynamic?)': Product of output shape dimensions does not match product of argument shape dimensions (output shape: Shape{1, 2, 3888336896}, argument shape: {2,3888336896}).

@maxlytkin
Copy link

@natxopedreira
Seems like this is a known issue with OpenVINO Raspbian package working with face-detection-adas-0001 and face-detection-retail-0005 models. Developers are aware of this.

@natxopedreira
Copy link

Hi @maxl16

Thank you for your reply, but....

Models from this folder
https://download.01.org/opencv/2020/openvinotoolkit/2020.2/open_model_zoo/models_bin/3/

Using code
import cv2 as cv
import imutils
import time

model_face_bin = 'face-detection-0106.bin'
model_face_xml = 'face-detection-0106.xml'

net = cv.dnn.readNet(model_face_xml,model_face_bin)
net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)

frame = cv.imread('autofoto.jpg')
blob = cv.dnn.blobFromImage(frame,size=(frame.shape[1],frame.shape[0]),ddepth=cv.CV_8U)
net.setInput(blob)
out = net.forward()

resume:
-face-detection-0100 do not work
-face-detection-0102 do not work
-face-detection-0104 do not work
-face-detection-0105 new error
terminate called after throwing an instance of 'InferenceEngine::NotFound' what(): Layer 1746.0 not found in network
-face-detection-0106 same error as 105
-face-detection-retail-0004 do not work

Note: do not work, means same error mentioned in this thread

.... will be faster if you can tell me which face models works

@alalek
Copy link

alalek commented May 21, 2020

cv.dnn.readNet(model_face_xml,model_face_bin)

OpenCV in OpenVINO 2020.2 has a bug for MYRIAD target (however with another message on x86 host). Should be fixed here: opencv/opencv#17134

Consider using IE API (see OpenModelZoo demos) or wait for the next OpenVINO release or recompile OpenCV from master branch.

/cc @dkurt

@natxopedreira
Copy link

Ok, i will build opencv from master branch and try, will post here results.

@natxopedreira
Copy link

@alalek
Are you sure master branch opencv? I just compiled and error persist

4.3.0-dev
Traceback (most recent call last):
  File "openvino_test.py", line 23, in <module>
    out = net.forward()
cv2.error: OpenCV(4.3.0-dev) /opencv/modules/dnn/src/op_inf_engine.cpp:881: error: (-2:Unspecified error) in function 'initPlugin'
> Failed to initialize Inference Engine backend (device = MYRIAD): Check 'input_shape_product.get_length() == shape_size(m_output_shape)' failed at /teamcity/work/scoring_engine_build/releases_2020_2/ngraph/src/ngraph/op/reshape.cpp:100:
> While validating node 'v0::Reshape Reshape_18830(PriorBoxClustered_18233[0]:f32{2,3012366592}) -> (dynamic?)':
> Product of output shape dimensions does not match product of argument shape dimensions (output shape: Shape{1, 2, 3012366592}, argument shape: {2,3012366592}). 

@dkurt
Copy link
Contributor

dkurt commented May 21, 2020

@natxopedreira, please read the logs carefully - it's not OpenCV error,

ngraph/src/ngraph/op/reshape.cpp:100

@natxopedreira
Copy link

@dkurt thank you!

To be clear, sorry but i never say is an opencv error, @alalek mentioned that you can read two post up

I followed their advice building opencv from master and error persist

I also followed your advice applying those patches to ngraph and still doesn't work, ngraph people offered help but is asking for info i don't have

NervanaSystems/ngraph#4794

Im open to ideas on how to solve this!

@dkurt
Copy link
Contributor

dkurt commented May 21, 2020

@natxopedreira , according to the error message, binary OpenVINO is used, not a custom build you tried:

Check 'input_shape_product.get_length() == shape_size(m_output_shape)' failed at /teamcity/work/scoring_engine_build/releases_2020_2/ngraph/src/ngraph/op/reshape.cpp:100:

you need to clean build folder first then specify InferenceEngine_DIR as mentioned here: https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md#add-inference-engine-to-your-project

@natxopedreira
Copy link

@dkurt Thank you
Yes, thats because i was trying to build and replace only opencv not openvino.

I compiled openvino from source
#500

And still get that error
This time i posted on intel forums, but as usually get no answer
https://software.intel.com/en-us/forums/intel-distribution-of-openvino-toolkit/topic/856588#comment-1959306

As you can see here, is a custom build

RuntimeError: Check 'input_shape_product.get_length() == shape_size(m_output_shape)' failed at /home/pi/openvino/ngraph/src/ngraph/op/reshape.cpp:100:
While validating node 'v0::Reshape Reshape_1991(PriorBoxClustered_1394[0]:f32{2,3443079936}) -> (dynamic?)':

Product of output shape dimensions does not match product of argument shape dimensions (output shape: Shape{1, 2, 3443079936}, argument shape: {2,3443079936}).

Should i try to build openvino with a build opencv?

@natxopedreira
Copy link

So in resume

What i have tried:

What else i can try?

@eclectriq
Copy link

@natxopedreira

Give this a try.

Then download the 2019 R1 models such as:

I have a Pi 4 with the NCS 2 and it worked properly. Good luck!

@natxopedreira
Copy link

@eclectriq

Thank you, yes that works, thats what im using. Problem here is that i want to use the new face models present on 2020 version..... and i can't.

Also want to use opencv instead IE API because opencv is faster, at least in my tests

So im forced to wait.....

@carnytom
Copy link

@natxopedreira

no idea if this helps ? but below is the code i'm using using open cv with the below cascade xml
haarcascade_frontalface_default.zip

from picamera import PiCamera

from time import sleep
import cv2
import numpy as np
import matplotlib.pyplot as plt
cap = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
def detect_face(img):
face_img=img.copy()
face_rects = face_cascade.detectMultiScale(face_img)
for (x,y,w,h) in face_rects:
cv2.rectangle(face_img,(x,y),(x+w,y+h),(0,0,255),5)
return face_img

#width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
#height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))

while True:

    ret,frame = cap.read(0)
    frame = detect_face(frame)
    cv2.imshow('Video face Detect',frame)

    k = cv2.waitKey(1)
    if k == 27:
            break

cap.release()
cv2.destroyAllWindows()

@natxopedreira
Copy link

@carnytom

Thank you!!! but i want to use a neural network, it works much better that haarcascade

@juvinski
Copy link

Hi guys,

I'm facing the same error with a custom model on rasp 4 with ncs2.
Any clue how to use this custom model ?

@natxopedreira
Copy link

Hi @juvinski

Sadly i think is no solution until there is a new openvino release, i tried compiling openvino, opencv, ngraph.... and nothing

But as is a custom model you can try to use this flag "--generate_deprecated_IR_V7" when using the model optimizer to generate IR version, "with that flag you do a lower version model".

Note im not an expert here but problem seems to happens when you want to inference with a IR10 version model, using older models (from 2019R3 release for example) works.

Let us know if works! Good luck!

@juvinski
Copy link

Hi @natxopedreira ,

I tried and works !

Thanks

@ilyachur
Copy link
Contributor

Hi @juvinski

Did you try a Model Optimizer flag "--generate_deprecated_IR_V7"?

The issue affects only IR v10, but I was sure that the problem was resolved for the master branch.

Could you please try to the last master branch? And provide an error and stacktrace if it doesn't work for your case.

Thanks.

@natxopedreira
Copy link

@ilyachur Was this solved in a recent update on the master branch?

@ilyachur
Copy link
Contributor

@natxopedreira Yes, as I know the final fix was merged to the master branch 5 days ago (ca9a788)

@natxopedreira
Copy link

Ohhhh, thats great!!!

Thanks for let us know @ilyachur i will build from master branch later and try, last time i tried was 8 days ago

@ilyachur
Copy link
Contributor

@natxopedreira Ok, cool!

Please let us know about your results.

@natxopedreira
Copy link

@ilyachur

I compiled from master branch and mixed results, let me explain.

IECore seems to work but opencv is broken so i can not do infer on a sample image, i dont know if it will trow an error when call infer.....

At least i was able to get to this point, this works no errorr

from openvino.inference_engine import IECore

ie = IECore()
model = ie.read_network("face-detection-0100.xml", "face-detection-0100.bin")
input_layer_name = next(iter(model.inputs))
output_layer_name = next(iter(model.outputs))
exec_model = ie.load_network(model, 'MYRIAD')
n, c, h, w = model.inputs[input_layer_name].shape

But importing opencv is trowing an error complaining about a lib that is not present when build
ImportError: libinference_engine_nn_builder.so: cannot open shared object file: No such file or directory

@ilyachur
Copy link
Contributor

@natxopedreira

NN Builder was deprecated several releases before and it is removed in the master branch.
Looks like something in your environment was built with old version of Inference Engine and depends on this library.

Can you check dependencies for your project? Maybe you have another version of inference engine in the environment.

@natxopedreira
Copy link

@ilyachur

Note that this error is only doing import cv2 in a python shell and that before setting the enviroment vars it will throw an error as no module named cv2 because python-opencv is not installed

Those are my enviroment vars

pi@raspberrypi:~ $ echo $LD_LIBRARY_PATH
/home/pi/openvino/bin/armv7l/Release/lib/:/home/pi/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/opencv/lib/:/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/python/python3/:/openvino/bin/armv7l/Release/lib/:/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/opencv/lib/:/openvino/bin/armv7l/Release/lib/:/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/opencv/lib/:

pi@raspberrypi:~ $ echo $PYTHONPATH
/home/pi/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/python/python3:/home/pi/openvino/bin/armv7l/Release/lib/python_api/python3.7/:/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/python/python3/:/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/python/python3:/openvino/bin/armv7l/Release/lib/python_api/python3.7/:/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/python/python3:/openvino/bin/armv7l/Release/lib/python_api/python3.7/:

Those are the vars im setting pointing to the new install
export PYTHONPATH="/openvino/bin/armv7l/Release/lib/python_api/python3.7/:$PYTHONPATH"
export PYTHONPATH="/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/python/python3:$PYTHONPATH"
export LD_LIBRARY_PATH="/openvino/inference-engine/temp/opencv_4.3.0_debian9arm/opencv/lib/:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/openvino/bin/armv7l/Release/lib/:$LD_LIBRARY_PATH"

Here is it my cmake settings and Docker file
https://gist.github.com/natxopedreira/4afe59035feed60a0721fc98e50015da

But if you think is helpful i can do a fresh buster install and try it again? Im very interested in making this work and im happy to do all the test that are necesary

Thank you

@dkurt
Copy link
Contributor

dkurt commented May 27, 2020

@natxopedreira, you need to build IE first then build OpenCV. opencv_4.3.0_debian9arm is compiled against OpenVINO 2020.2

@natxopedreira
Copy link

@dkurt thank you, so i need to build also opencv.... i was only building IE.

Ok, i will build opencv agains openvino built from master branch

@ilyachur
Copy link
Contributor

@natxopedreira Thank you.
Please let us know about results.

@natxopedreira
Copy link

@ilyachur No luck, im not able to build opencv from source

Sure im doing something wrong but i dont know whats happening, note that im able to build opencv without making that change to use custom openvino build instead the one that downloads by default.

/opencv/modules/dnn/src/op_inf_engine.cpp:50:2: error: #error "Build configuration error: nGraph or NN Builder API backend should be enabled"
#error "Build configuration error: nGraph or NN Builder API backend should be enabled"
^~~~~
[ 81%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/rho.cpp.o
/opencv/modules/dnn/src/op_inf_engine.cpp: In function 'cv::dnn::dnn4_v20200310::Backend& cv::dnn::getInferenceEngineBackendTypeParam()':
/opencv/modules/dnn/src/op_inf_engine.cpp:52:9: error: expected primary-expression before ')' token
)

In cmake i put those vars pointing to openvino master build
-DINF_ENGINE_LIB_DIRS="/openvino/bin/armv7l/Release/lib" \
-DINF_ENGINE_INCLUDE_DIRS="/openvino/inference-engine/include" \
-DCMAKE_FIND_ROOT_PATH="/openvino" \

@natxopedreira
Copy link

@dkurt sorry for disturbing, can you please tell me if you know that compiling current opencv master branch against a openvino built also from master branch works in this moment?

I tried several times and always get same error, maybe building with that config is currently broken because of recent changes in openvino master branch

Thank you

@ilyachur
Copy link
Contributor

@dkurt Can you help with OpenCV isssue?

@dkurt
Copy link
Contributor

dkurt commented May 28, 2020

@natxopedreira, issues is related to nGraph API changes and that IE has no identificators for release version. Please specify release manually: -DINF_ENGINE_RELEASE=2020040000:

--   Other third-party libraries:
--     Inference Engine:            YES (2020040000 / 2.1.0)
--         * libs:                  /openvino/bin/armv7l/Release/lib/libinference_engine_legacy.so
--         * includes:              _inc-NOTFOUND
--     nGraph:                      YES (0.0.0+246790f)
--         * libs:                  /openvino/bin/armv7l/Release/lib/libngraph.so
--         * includes:              /openvino/ngraph/src
Dockerfile
FROM debian:buster

USER root

RUN dpkg --add-architecture armhf && \
    apt-get update && \
    apt-get install -y --no-install-recommends \
    build-essential \
    crossbuild-essential-armhf \
    git \
    wget \
    cmake \
    libusb-1.0-0-dev:armhf \
    libgtk-3-dev:armhf \
    libavcodec-dev:armhf \
    libavformat-dev:armhf \
    libswscale-dev:armhf \
    libgstreamer1.0-dev:armhf \
    libgstreamer-plugins-base1.0-dev:armhf \
    libpython3-dev:armhf \
    libpython-dev:armhf \
    python3-numpy \
    python-numpy \
    python3-pip

# Build Inference Engine (https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md#build-for-raspbian-stretch-os)
RUN git clone https://github.com/openvinotoolkit/openvino
RUN cd openvino && mkdir build && cd build && \
    git submodule init && git submodule update --recursive && \
    cmake -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_TOOLCHAIN_FILE="../cmake/arm.toolchain.cmake" \
    -DTHREADS_PTHREAD_ARG="-pthread" \
    -DENABLE_SSE42=OFF \
    -DTHREADING=SEQ \
    -DNGRAPH_ONNX_IMPORT_ENABLE=OFF \
    -DENABLE_GNA=OFF .. && make --jobs=$(nproc --all)

# Build OpenCV (https://github.com/opencv/opencv/wiki/Intel%27s-Deep-Learning-Inference-Engine-backend#raspbian-buster)
RUN git clone https://github.com/opencv/opencv --depth 1
RUN cd opencv && mkdir opencv_build && mkdir opencv_install && cd opencv_build && \
    cmake -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX="../opencv_install" \
      -DOPENCV_CONFIG_INSTALL_PATH="cmake" \
      -DCMAKE_TOOLCHAIN_FILE="../platforms/linux/arm-gnueabi.toolchain.cmake" \
      -DWITH_IPP=OFF \
      -DBUILD_TESTS=OFF \
      -DBUILD_PERF_TESTS=OFF \
      -DOPENCV_ENABLE_PKG_CONFIG=ON \
      -DPKG_CONFIG_EXECUTABLE="/usr/bin/arm-linux-gnueabihf-pkg-config" \
      -DPYTHON2_INCLUDE_PATH="/usr/include/python2.7" \
      -DPYTHON2_NUMPY_INCLUDE_DIRS="/usr/local/lib/python2.7/dist-packages/numpy/core/include" \
      -DPYTHON3_INCLUDE_PATH="/usr/include/python3.7" \
      -DPYTHON3_NUMPY_INCLUDE_DIRS="/usr/local/lib/python3.7/dist-packages/numpy/core/include" \
      -DPYTHON3_CVPY_SUFFIX=".cpython-37m-arm-linux-gnueabihf.so" \
      -DENABLE_NEON=ON \
      -DCPU_BASELINE="NEON" \
      -DWITH_INF_ENGINE=ON \
      -DINF_ENGINE_RELEASE=2020040000 \
      -DINF_ENGINE_LIB_DIRS="/openvino/bin/armv7l/Release/lib/" \
      -DINF_ENGINE_INCLUDE_DIRS="/openvino/inference_engine/include" \
      -DCMAKE_FIND_ROOT_PATH="/openvino/build" .. && \
    make --jobs=$(nproc --all) && make install

@natxopedreira
Copy link

@dkurt @ilyachur Thank you!! it works but i think something is wrong here.

3 seconds to do an inference on a 320x240 image!!!

import cv2 as cv
import imutils
import time

model_face_bin = 'face-detection-retail-0004.bin'
model_face_xml = 'face-detection-retail-0004.xml'

net = cv.dnn.readNet(model_face_xml,model_face_bin)
net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)

frame = cv.imread('autofoto.jpg')
frame = imutils.resize(frame, width=320)

inicio = time.time()
blob = cv.dnn.blobFromImage(frame,size=(frame.shape[1],frame.shape[0]),ddepth=cv.CV_8U)
net.setInput(blob)
out = net.forward()
print(time.time()-inicio)

@dkurt
Copy link
Contributor

dkurt commented May 29, 2020

Do warmup runs before actual efficiency measurements. Like here: opencv/opencv#17295 (comment).

@natxopedreira
Copy link

@dkurt
Thank you, just did some test as you suggested with running a first inference to warm up, big difference. I always used this on video so i assume thats why never notice that before. Is like the model in the first inference is loaded on memory or something....i learned something new, thanks

model_face_bin = 'face-detection-retail-0004.bin'
model_face_xml = 'face-detection-retail-0004.xml'

net = cv.dnn.readNet(model_face_xml,model_face_bin)
net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)

frame = cv.imread('autofoto.jpg')
frame = imutils.resize(frame, width=320)
blob = cv.dnn.blobFromImage(frame,size=(frame.shape[1],frame.shape[0]),ddepth=cv.CV_8U)
net.setInput(blob)
net.forward()

speeds = []
for i in range(1000):
blob = cv.dnn.blobFromImage(frame,size=(frame.shape[1],frame.shape[0]),ddepth=cv.CV_8U)
net.setInput(blob)
start = time.time()
net.forward()
speeds.append((time.time() - start) * 1000)
print('%.2fms|%.2fms|%.2fms|%.2f' % (np.min(speeds), np.median(speeds), np.mean(speeds), np.std(speeds)))

/opt/intel/opencv/opencv_install/lib/python3.7/dist-packages/cv2/python-3.7/cv2.cpython-37m-arm-linux-gnueabihf.so
18.19ms|19.10ms|19.09ms|0.20

@ilyachur
Copy link
Contributor

@natxopedreira
If you don't have any questions, can you confirm that issue was solved and close it?

@natxopedreira
Copy link

@ilyachur
Yes, it works!!! Thank you, i think i have a bad var enviroment value as i can not import openvino, maybe something changed it position on last changes on openvino master, i will take a look later.

Sorry i can not close it, im not the original autor, @tgonzalez89 can you check and close it please?

@ilyachur ilyachur added bug Something isn't working category: Core OpenVINO Core (aka ngraph) labels May 29, 2020
@ilyachur
Copy link
Contributor

ilyachur commented Jun 2, 2020

@tgonzalez89 I am closing the ticket because I didn't get a feedback from your side but @natxopedreira confirmed that his problem was resolved.

Feel free to reopen this ticket if the solution doesn't work for you or you have any questions.

@elap2
Copy link

elap2 commented Mar 7, 2021

[ INFO ] InferenceEngine:
API version ............ 2.1
Build .................. 2021.2.0-1877-176bdf51370-releases/2021/2
Description ....... API
Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ] /home/pi/Pictures/christina.jpg
[ INFO ] Loading Inference Engine
[ INFO ] Device info:
MYRIAD
myriadPlugin version ......... 2.1
Build ........... 2021.2.0-1877-176bdf51370-releases/2021/2
[ INFO ] Loading network files:
face-detection-adas-0001.xml
[ ERROR ] Model file face-detection-adas-0001.xml cannot be opened!

should I install another openvino toolkit version to test it? I installed this l_openvino_toolkit_runtime_raspbian_p_2021.2.185.tgz

Thanks

@Guemann-ui
Copy link

Hi there!

I'm trying to rum my yolov5 demo on RPI, the same script I ran on CPU and works fine, but with RPI when I use this line: $python3 demo.py -m model.xml -d MYRIAD -i image.jpeg.
The process run stopped in "[INFO] Preparing inputs" ! any help, please? how can I run my custom python demo on RPI?

redradist pushed a commit to redradist/openvino that referenced this issue Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working category: Core OpenVINO Core (aka ngraph)
Projects
None yet
Development

No branches or pull requests