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.

Raspberry PI4 - OpenVino - Open CV DNN - net.forward - Segmentation fault - NCS2 - Myriad

gupta__himant
Beginner
1,565 Views

I am using OpenVino recent kit : l_openvino_toolkit_runtime_raspbian_p_2020.2.120.tgz Raspberry - Pi4. Open CV 4.3.0-openvino.

Trying to use the OpenCV DNN with tensorflow net and also caffe. But getting segmentation fault at net.forward() call.

I am using ssd inception v2 .

Below is the code for tensorflow in Python . I do not know how to proceed and resolve it. I tried searching and could not find a working solution for this.

Steps I am doing ( the paths are configured correctly )

Initialize the tensorflow net

tensorflowNet = cv2.dnn.readNetFromTensorflow(PATH_TO_CKPT, PATH_TO_LABELS)

tensorflowNet.setPreferableTarget(cv2.dnn.DNN_TARGET_MYRIAD) ## set to use the NCS2

PASS THE BLOB TO TENSORFLOW NETWORK

blob = cv2.dnn.blobFromImage(frame, size=(300, 300), swapRB=True, crop=False)

pass the blob through the network and obtain the detections and

tensorflowNet.setInput(blob)

print ("Before forward")

detections =tensorflowNet.forward()

print("after forward")

It fails at .forward method.Console out put is as below.

pi@raspberrypi:~/guardeyelite $ python3 OpenCVTensorFlow.py Frame found

processing frame done

Before forward

Segmentation fault

-----------------------

When using GDB Python3 - I get the following : [New Thread 0xa0a29460 (LWP 3574)] Thread 1 "python3" received signal SIGSEGV, Segmentation fault. 0xaefeeeda in ?? () from /opt/intel/openvino/deployment_tools/ngraph/lib/libngraph.so (gdb)

I do not know how to proceed

0 Kudos
9 Replies
David_C_Intel
Employee
1,565 Views

Hi Himant,

Thanks for reaching out. 

Could you please give us the corresponding files to test your issue from our end? (Such as the .pb, .pbtxt and the .py)

Regards,

David

0 Kudos
gupta__himant
Beginner
1,565 Views

Hi,

Yes, sure. I have uploaded the files. My python file has the same code as above, there is nothing special.

I am sharing some snippet again below

Our purpose is to use NCS2 only for inference.

I also tried using previous version of toolkit - but did not work.

tensorflowNet = cv2.dnn.readNetFromTensorflow(PATH_TO_CKPT, PATH_TO_LABELS)
tensorflowNet.setPreferableTarget(cv2.dnn.DNN_TARGET_MYRIAD) ## set to use the NCS2

#PASS THE BLOB TO TENSORFLOW NETWORK

blob = cv2.dnn.blobFromImage(frame, size=(300, 300), swapRB=True, crop=False)

tensorflowNet.setInput(blob)

print ("Before forward")

detections =tensorflowNet.forward() ### FAILING HERE

print("after forward")

Regards,

Himant

0 Kudos
David_C_Intel
Employee
1,565 Views

Hi Himant,

Thank you for the files provided.

We tested this on Rpi and we encountered the same problem. As you are using ssd_inception_v2, this is a network that is not supported by the Myriad plugin, you can check all the supported networks here. Also, for more information on future projects, you can check the supported layers documentation. 

Best regards,

David

0 Kudos
gupta__himant
Beginner
1,565 Views

Hi David,

Thanks for the update.

While using , i found out that opencv , precompiled is not having opencv contrib.

I have an issue now with trackers. I saw another post in the forums for the same, but could not solve with source compilation of openCV4.2 Openvino.

Current situation is as below :

1. Openvino toolkit with  opencv 4.2.0-openvino

2. Source compiled opencv 4.2-openvino + open contrib

3. What changes in setupvars shall be done. ( I only want to use the contrib module, and keep using the openvino opencv) - Is it feasible?

4. If i change also opencv path to source compiled version - the myriad plygin doesnt work.

Regards,

Himant

0 Kudos
David_C_Intel
Employee
1,565 Views

Hi Himant,

Thank you for your reply.

If you want to use your own OpenCV version, I recommend you to install the open-source version of Intel® OpenVINO™ toolkit, the Deep Learning Development Toolkit (DLDT). This guide will help you on its installation.

If this doesn't work and you keep getting issues with OpenCV, you should post this inquiry in an OpenCV support forum since you are having trouble using pure OpenCV.

Regards,

David

0 Kudos
gupta__himant
Beginner
1,565 Views

Hello David,

While doing the steps from DLDT part, the CMAKE keeps failing with the following errors in Error file.

My command for CMAKE is as follows

sudo cmake -DCMAKE_SHARED_LINKER_FLAGS=-pthread -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='-march=armv7-a' -DENABLE_MKL_DNN=OFF -DENABLE_CLDNN=OFF -DENABLE_GNA=OFF -DENABLE_SSE42=OFF -DTHREADING=SEQ ..

Error is as below

File /home/pi/dldt/inference-engine/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/pi/dldt/inference-engine/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_41824/fast"
/usr/bin/make -f CMakeFiles/cmTC_41824.dir/build.make CMakeFiles/cmTC_41824.dir/build
make[1]: Entering directory '/home/pi/dldt/inference-engine/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_41824.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_41824.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.13/Modules/CheckFunctionExists.c
Linking C executable cmTC_41824
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_41824.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_41824.dir/CheckFunctionExists.c.o  -o cmTC_41824 -lpthreads

Let me know, how to proceed with it please.

Thanks

0 Kudos
David_C_Intel
Employee
1,565 Views

Hi Himant,

Thank you for the information.

We are looking into this issue, we will contact you as soon as possible.

Regards, 

David

0 Kudos
David_C_Intel
Employee
1,565 Views

Hi Himant,

If you are having trouble with building the DLDT in Rpi, you can check in the github repository, the Build for Raspbian Stretch* OS instructions. 

Best regards,

David 

0 Kudos
gupta__himant
Beginner
1,565 Views

Hi,

I managed with openvino version from Jan,2020. Other versions are problematic as of now.

FYI, even SSD inception is also working with this version and even without convertion to .bin/.xml

Regards,

Himant

0 Kudos
Reply