Ask Your Question

Revision history [back]

The best person to ask is @Yashas. That said for the reasons explained below this will not currently work.

From a quick inspection of the source code it doesn't look like any of the dnn functions are built to work with GpuMat, for example; blobFromImages() will always retrieve a Mat from an InputArrayOfArrays and then perform resizing, cropping etc. on the host; and predict() will only work with 'Mat'. In C++ these functions may take a GpuMat as input (I need to check this but at least in theory this should not be a problem due to the TAPI) but even if they do they will download them to the host before performing any processing.

Secondly because the dnn module is not in the CUDA namespace, python bindings for processing GpuMat are not generated meaning the function call will fall through to UMat giving you the

TypeError: Expected Ptr<cv::umat> for argument 'image'

you observed.