skip to Main Content

I have a development machine working with ubuntu 22, python 3.10 and cv2; when I try to replicate on another machine then I get runtime error:
from section calling age prediciton from haarclassifier and age_net.caffemodel:
line 118 return age_net-forward()
cv2.error: OpenCV(4.7.0-dev)
(note this after building files from source orcv2 4.7.0 or 4.6.0 same result)
/home/art/opencv_build/opencv/modules/dnn/src/layers/cpu_kernels/conv_winograd_f63.cpp:401: error: (-215:Assertion failed) CONV_WINO_IBLOCK == 3 && CONV_WINO_ATOM_F32 == 4 in function ‘winofunc_BtXB_8x8_f32’

I have tried various permutations of installing opencv-python or opencv-contrib-python or building and compiling the opencv files from source, always with the same result. Works on the original machine but always throws this error on the second machine when running the same python code.

I have searched online generally and in stackoverflow and I don’t see anyone noting this error.
Anyone know?

Tried to duplicate machine where it is working and various permuations of installing opencv either directly:
pip3 install opencv-python
or
pip3 install opencv-contrib-python
or build the opencv files from source,

which is generally to build the dependencies:

sudo apt install build-essential cmake git pkg-config libgtk-3-dev     libavcodec-dev libavformat-dev libswscale-dev libv4l-dev     libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev     gfortran openexr libatlas-base-dev python3-dev python3-numpy     libtbb2 libtbb-dev libdc1394-dev

clone the repositories:

    $ mkdir ~/opencv_build && cd ~/opencv_build
    $ git clone https://github.com/opencv/opencv.git
    $ git clone https://github.com/opencv/opencv_contrib.git

make:

    Sudo ~/opencv_build/opencv/cmake -D CMAKE_BUILD_TYPE=RELEASE   -D WITH_VTK=OFF -D    BUILD_opencv_viz=OFF
  -D CMAKE_INSTALL_PREFIX=/usr/local     -D INSTALL_C_EXAMPLES=ON     -D INSTALL_PYTHON_EXAMPLES=ON     -D OPENCV_GENERATE_PKGCONFIG=ON     -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules     -D BUILD_EXAMPLES=ON ..

and then install

I check all the python code, file folder setup etc is the same, both running ubuntu 22, amd 64 bit.
Works in the original machine, always throws the error in the second. The python code correctly captures an image, recognizes the face, crops the image and saves it before encountering the error, so the error is specifically to the haarclassifier and age prediction.
I can’t find any documentation or comments on the subject.

2

Answers


  1. Chosen as BEST ANSWER

    yes I reverted to 4.6.0.66 by 'sudo pip install opencv-contrib-python==4.6.0.66' to call the specific version and this version works whereas 4.7 does not work so I'm sure they will figure out whatever bug exists in their newest release.


  2. Today I tried out OpenCV 4.5.5.
    Works for me now.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search