I'm trying to do inference with OpenVino Model Optimizer as detailed here.
The code I have so far runs without installing cv2, but I can't get any further because trying to import cv2 consistently throws an error. The code is:
import openvino
from openvino.inference_engine import IECore, IENetwork
import cv2
ie = IECore()
net = ie.read_network(model='saved_model.xml', weights='saved_model.bin')
This runs without
import cv2
However, anytime the cv2 import is included the following error is thrown:
File "/opt/intel/openvino_2021/python/python3.9/cv2/__init__.py", line 129, in <module>
bootstrap()
File "/opt/intel/openvino_2021/python/python3.9/cv2/__init__.py", line 112, in bootstrap
import cv2
ImportError: dlopen(/opt/intel/openvino_2021.4.752/python/python3.9/cv2/python-3/cv2.so, 2): Symbol not found: _objc_alloc_init
Referenced from: /opt/intel/openvino_2021.4.752/python/python3.9/cv2/python-3/../../../../opencv/lib/libopencv_videoio.4.5.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libobjc.A.dylib
in /opt/intel/openvino_2021.4.752/python/python3.9/cv2/python-3/../../../../opencv/lib/libopencv_videoio.4.5.dylib
I've tried downgrading cv2 to various previous versions but this did not seem to help. cv2 is needed for the cv2.dnn.blobFromImage method which I'm trying to use in this script.
Has anyone seen this problem before? Not sure how to interpret this error message.