Using opencv to build a model

If you add the opencv-python library to your dependencies and import the cv2 module, you will see the following error Exception: Error in importing module cannot open shared object file: No such file or directory.

To fix the problem, we need to modify the base Docker image and use qwakai/qwak:0.0.13-opencv-cpu-py39 as the base image. If you use the GPU instance, you should set qwakai/opencv-gpu-py39 as the base image.

We can do it in two ways

We can add the --base-image qwakai/qwak:0.0.13-opencv-cpu-py39 parameter to the qwak models build, or we can use the yaml configuration file. The usage of yaml configuration is described in details in our Building a Qwak Model page.

    base_image: qwakai/qwak:0.0.13-opencv-cpu-py39