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.

openvino_2021.4.752

PhilC_1
Novice
1,029 Views

Hi,

 

I am running a MAC (Big Sur 11.6.1) with openvino_2021.4.752. I have run setvars.bat, but I cannot run my version of your classify c++ code.

 

The error I get is 

dyld: lazy symbol binding failed: Symbol not found: __ZN2cv3dnn14dnn4_v2021060815readNetFromONNXERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE
Referenced from: /Users/culverhouse/Code/PIA/Projects/PI/PI_DNN_LabelSort_Debug/PI_DNN_LabelSort
Expected in: /usr/local/lib/libopencv_dnn.4.5.dylib

dyld: Symbol not found: __ZN2cv3dnn14dnn4_v2021060815readNetFromONNXERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE
Referenced from: /Users/culverhouse/Code/PIA/Projects/PI/PI_DNN_LabelSort_Debug/PI_DNN_LabelSort
Expected in: /usr/local/lib/libopencv_dnn.4.5.dylib

 

The code is as follows:

// //PFC 12.02.22 fix parameters for Turing SG DNN
int rszWidth = 224; // parser.get<int>("initial_width");
int rszHeight = 224; //parser.get<int>("initial_height");
// float scale = 1.0; //parser.get<float>("scale");
// Scalar mean = 0.5; //parser.get<Scalar>("mean");
// Scalar std = 1.0;//parser.get<Scalar>("std");
// bool swapRB = false; //parser.get<bool>("rgb");
// bool crop = false; //parser.get<bool>("crop");
// int inpWidth = 224; //parser.get<int>("width");
// int inpHeight = 224; //parser.get<int>("height");
String framework = "";//parser.get<String>("framework");
int backendId = 2; // PFC OPENVINO engine
int targetId = 0; // fix to CPU PFC 12.02.22

//************* Model embedded at present
// string modelname="CopNonDetritus_FP16";
//string modelname="CopNonDetritus_42317_FP16";
string modelname="CopNonDetritus_42317_FP64";
// String model = ModelPath + PATHNAME_TOKENS::Sep + modelname + ".bin";
// String config = ModelPath + PATHNAME_TOKENS::Sep + modelname + ".xml";
String model = ModelPath + PATHNAME_TOKENS::Sep + modelname + ".bin";
String config = ModelPath + PATHNAME_TOKENS::Sep + modelname + ".xml";
String LabelPath = ModelPath + PATHNAME_TOKENS::Sep + modelname +"_Labels.xml";

//! [Read and initialize network]


//Net net = readNet(model, config, framework);
Net net = readNetFromONNX(ModelPath + PATHNAME_TOKENS::Sep + "model.onnx");
//Net net = readNetFromModelOptimizer(config,model);

 

I have tried all three readNet() functions, they all give the same error.

I am using QT: 6.02 with Xcode: 13.2.1 Clang: x86_64-apple-darwin20.6.0

 

I can run the model (Resnet-50 PyTorch) using the Python version of the code. Its just the C++ version that fails.


Do I have to wait for Big Sur libraries?

 

Any ideas most welcome

0 Kudos
1 Solution
PhilC_1
Novice
1,021 Views

OK, OK sorry for the post. After extensive exploration (a week) I have found that I needed to copy the /opt/intel/deployment tools/*.dylib and opencv/lib/* & include/*  into the /usr/local/lib.

 

Then I had to ensure that I in't have any old openvino python packages anywhere.

 

Then I found that only 

Net net = readNetFromONNX(ModelPath + PATHNAME_TOKENS::Sep + ModelName + ".onnx");

worked. The other options for reading a net fell over. 

 

****So, please can the documentation for MAC not assume that the compiler will pick up the correct libraries from /opt/intel.

And perhaps have a make install script that copies everything into the correct system folders, just as a std. install of opencv would do, or any linux system.

View solution in original post

5 Replies
PhilC_1
Novice
1,024 Views

Hi, 

 

An update. For some reason, I was not searching the correct install folder  (/opt/intel...). So I copied the opencv libraries, links and includes to the /usr/local/lib & include locations.

 

Now my error is the following:


dyld: Library not loaded: @rpath/libinference_engine_c_api.dylib
Referenced from: /usr/local/lib/libopencv_dnn.4.5.3.dylib
Reason: image not found

 

I have no idea why it wants to use rpath to get the library. But I can confirm that the /usr/local/lib/libopencv_dnn.4.5.3.dylib exists.

 

Phil

0 Kudos
PhilC_1
Novice
1,022 Views

OK, OK sorry for the post. After extensive exploration (a week) I have found that I needed to copy the /opt/intel/deployment tools/*.dylib and opencv/lib/* & include/*  into the /usr/local/lib.

 

Then I had to ensure that I in't have any old openvino python packages anywhere.

 

Then I found that only 

Net net = readNetFromONNX(ModelPath + PATHNAME_TOKENS::Sep + ModelName + ".onnx");

worked. The other options for reading a net fell over. 

 

****So, please can the documentation for MAC not assume that the compiler will pick up the correct libraries from /opt/intel.

And perhaps have a make install script that copies everything into the correct system folders, just as a std. install of opencv would do, or any linux system.

IntelSupport
Community Manager
998 Views

Hi PhilC_1,

 

Thanks for reaching out to us.

 

I am glad that you are able to solve the issue and thanks for sharing the workaround here.

 

For your information, OpenVINO is validated only for macOS Catalina (10.15.x) which you may refer to System Requirements.

You can always refer to the Release Notes for new features enablement and supportabilities.

 

Meanwhile from our experiences, dylib errors that you had encountered are caused by a missing or bad library linking.

 

As for the Python environment, we suggest you install Intel® Distribution of OpenVINO™ Toolkit Developer Package, which is essentially an optimized package for the Python environment.

With this package, it will not require you to navigate around the folders, and please take note that this package can be installed on other versions of macOS but only Catalina is fully validated.

 To avoid conflict with existing Python packages, and dependencies, we recommend using a virtual environment.

 

Nevertheless, as you are already aware, the above solution works only for Python.

Our development team is currently working to enable support for C++ in future releases via our binary distribution.

 

 

Regards,

Aznie


0 Kudos
PhilC_1
Novice
987 Views

Thanks Aznie,

 

I have installed the dev env for python. But as you say, it is clear that you really only support Python properly. 

 

I look forward to the make install scripts to allow simple installation in an opencv C++ dev. machine. I need to use C++ for speed in other operations that I am running.

 

An interesting point is that my python FP16 solution runs very nicely on both a DELL XEON and my mac bookpro. But the C-version I can only run using your c++ libraries in FP32 or UINT8 modes thanks to the BlobFromImage () API, as your built image is only 4.5.3.

 

I tried using cmake with 4.5.5 but it could not locate an inference engine that was compatible with the build sources. I pointed to the /opt/intel/openvino_2021.4.752/deployment_tools/inference_engine/lib and the intel64 subfolder, but each time I ran cmake it would report not inference engine found. I assumed it was because the library format was wrong between the inference engine an the OS Big Sur.

 

best wishes

 

Phil

0 Kudos
IntelSupport
Community Manager
971 Views

Hi Phil,

 

Thank you for your sharing and suggestion. We appreciate that.

 

Therefore, this thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.

 

Regards,

Aznie


0 Kudos
Reply