You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dvr-scan reports an error when running with MOG2_CUDA.
Command:
dvr-scan -b MOG2_CUDA -i example.mp4
Output:
Traceback (most recent call last):
File "venv/dvr-scan/bin/dvr-scan", line 5, in <module>
from dvr_scan.__main__ import main
File "venv/dvr-scan/lib/python3.13/site-packages/dvr_scan/__init__.py", line 40, in <module>
from dvr_scan.platform import init_logger
File "venv/dvr-scan/lib/python3.13/site-packages/dvr_scan/platform.py", line 29, in <module>
from scenedetect.platform import get_and_create_path, get_ffmpeg_version
File "venv/dvr-scan/lib/python3.13/site-packages/scenedetect/__init__.py", line 54, in <module>
from scenedetect.scene_manager import SceneManager, save_images, SceneList, CutList, Interpolation
File "venv/dvr-scan/lib/python3.13/site-packages/scenedetect/scene_manager.py", line 413, in <module>
image: cv2.Mat,
^^^^^^^
AttributeError: module 'cv2' has no attribute 'Mat'
Environment:
Python 3.13
dvr-scan 1.6.2
scenedetect 0.6.5 (0.6.4 did not have this problem)
I replaced cv2.Mat with cv2.UMat in scene_manager.py and it works now. Basically some compilation of CUDA-enabled OpenCV does not have cv2.Mat but only cv2.UMat, e.g., python-opencv-cuda.
Python 3.13.1 (main, Dec 4 2024, 18:05:56) [GCC 14.2.1 20240910] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.Mat
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
cv2.Mat
AttributeError: module 'cv2' has no attribute 'Mat'
>>> cv2.UMat
<class 'cv2.UMat'>
>>>
I suspect this is related to #456 when cv2.Mat was added to scene_manager.py. I didn't have this issue with version 0.6.4
Thanks for letting me know, I'll make sure this prioritized for resolution in the next release. We should probably audit the use of cv2.Mat and replace most usages with numpy.ndarray.
Activity
subbyte commentedon Dec 23, 2024
Seems like someone else also encountered this: https://discuss.streamlit.io/t/attributeerror-module-cv2-has-no-attribute-mat/86727
[-]cv2.Mat does not exist in opencv cuda build[/-][+]cv2.Mat does not exist in some opencv cuda build[/+][-]cv2.Mat does not exist in some opencv cuda build[/-][+]cv2.Mat does not exist in opencv cuda build[/+]Breakthrough commentedon Dec 23, 2024
Thanks for letting me know, I'll make sure this prioritized for resolution in the next release. We should probably audit the use of
cv2.Matand replace most usages withnumpy.ndarray.[bugfix] Fix incorrect type hint leading to runtime failures #468
Breakthrough commentedon Dec 23, 2024
@subbyte I've just pushed a new version (0.6.5.2) that should fix this issue. Let me know if you run into any other issues, thanks for the report!
subbyte commentedon Dec 24, 2024
Fix confirmed. Thank you!