Hello OpenCV Community,
I am currently working on building OpenCV 4.10.0 from the master branch on GitHub. My goal is to enable GPU acceleration using Vulkan and integrate Python 3.12 bindings for image processing tasks. Here is my setup and process:
System Details:
- OS: Windows 10
- GPU: AMD RX 6700XT
- CMake Version: 3.31.0
- Compiler: Visual Studio 2022
- Vulkan SDK: 1.3.296.0 (configured in environment variables)
- Python: 3.12.0 (bindings required)
Build Configuration:
- Cloned OpenCV and opencv_contrib from the master branch on GitHub.
- Used the following CMake settings:
- Enabled
WITH_VULKAN
. - Set
PYTHON3_EXECUTABLE
,PYTHON3_INCLUDE_DIR
,PYTHON3_LIBRARY
, andPYTHON3_PACKAGES_PATH
for Python 3.12. - Configured Vulkan paths (
VULKAN_SDK
,Bin
,Lib
, andInclude
).
- Built OpenCV in Release mode using Visual Studio 2022.
Python Use Case:
The primary goal is to perform image similarity and feature matching tasks in Python, leveraging GPU acceleration for large-scale workloads:
- Splitting collages into individual design regions.
- Matching these regions with a dataset of images using ORB descriptors and BFMatcher.
- GPU acceleration via Vulkan for faster processing.
Issues Encountered:
- After successfully building OpenCV, Python bindings (
cv2
) load but are missing critical functionality:
cv2.haveVulkan()
raisesAttributeError: module 'cv2' has no attribute 'haveVulkan'
.cv2.dnn.getAvailableBackends()
raisesAttributeError: module 'cv2' has no attribute 'dnn'
.
- Vulkan backend doesn’t appear to be functional, despite enabling it in CMake and verifying that Vulkan SDK is properly installed and added to the environment variables.
- For Windows, I am wondering if there are better alternatives to Vulkan for GPU acceleration, such as OpenCL or CUDA (although CUDA isn’t an option for AMD GPUs).
Questions:
- Should I switch to the latest release version of OpenCV (e.g., 4.10.0 Latest) instead of building from the master branch? Would this resolve the missing Vulkan and DNN functionality in Python?
- Are there any known issues with Vulkan support on AMD GPUs (RX 6700XT) or with Python 3.12?
- What could be causing the
cv2
module to partially load (i.e., without critical attributes likehaveVulkan
anddnn
)? - On Windows, is there a better alternative to Vulkan for GPU acceleration when using AMD GPUs, or should I continue troubleshooting Vulkan?
Any advice or insights on these issues would be greatly appreciated. Thank you in advance!