Closed leo2tigers closed 7 months ago
Could you just import cv2
in Colab using v4.5.5.62 and get success call on, say, cv2.getBuildInformation() ?
This issue does not seem to be related to Albumentations package itself, but rather to OpenCV.
I've tried importing cv2
v4.5.5.62 and trying cv2.getBuildInformation()
and both appear to be successful.
Correct package name is opencv-python
not opencv
Try these commands:
pip uninstall opencv
pip install --upgrade opencv-python
Correct package name is
opencv-python
notopencv
Sorry, seems like it's a typo, the package I'm referencing should be opencv-python-headless
, not opencv
(according to albumentations pip installation logging)
For uninstalling and then reinstall method, I've tried but it doesn't help.
I found the solution in this stack overflow thread https://stackoverflow.com/questions/70537488/cannot-import-name-registermattype-from-cv2-cv2.
%pip uninstall opencv-python-headless
%pip install opencv-python-headless==4.1.2.30
Note that Colab version of the notebook here is currently broken because of this https://colab.research.google.com/github/albumentations-team/albumentations_examples/blob/colab/example_bboxes.ipynb
🐛 Bug
When using opencv (opencv-python-headless) 4.5.5, the library failed to be imported
To Reproduce
Steps to reproduce the behavior:
pip install --upgrade opencv_python_headless
import albumentations as A
Stack traces are as below
Expected behavior
The library could be loaded and used normally
Environment
conda
,pip
, source): pipAdditional context
The problem doesn't occur if using opencv 4.5.4 or below (I've tested with all opencv version from 4.4.0 and only found 4.5.5 (which was released around 5 hours ago as of this writing) to be problematic.)