Skip to content

Commit 66858d5

Browse files
alexarjeclaude
andcommitted
Fix GPU detection: _utils never imported cv2, so CUDA was always reported absent
get_cuda_device_count() and cuda_build_available() referenced cv2 but _utils.py never imports it, so they raised NameError (swallowed by except) and always returned 0/False. GPU was therefore reported unavailable even with a CUDA-enabled OpenCV — pose(device='gpu') always auto-switched to MediaPipe and the "built WITHOUT CUDA" message always showed. Import cv2 inside both helpers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7901775 commit 66858d5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

musicalgestures/_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,6 +1793,7 @@ def get_cuda_device_count():
17931793
module is unavailable or no devices are detected.
17941794
"""
17951795
try:
1796+
import cv2
17961797
return cv2.cuda.getCudaEnabledDeviceCount()
17971798
except Exception:
17981799
return 0
@@ -1806,6 +1807,7 @@ def cuda_build_available():
18061807
bool: True if OpenCV's build information reports CUDA support, else False.
18071808
"""
18081809
try:
1810+
import cv2
18091811
info = cv2.getBuildInformation()
18101812
except Exception:
18111813
return False

0 commit comments

Comments
 (0)