I have built OpenCV with Cuda for Python and am using the following lines to use GPU.
net = cv2.dnn.readNetFromCaffe(proto_file, weights_file)
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
However, my FPS with GPU is about 1.8 while it is about 0.8 with CPU. In the task manager, my GPU utilization is displayed as about 5%. My GPU is Nvidia GeForce MX130. How can I increase my GPU utilization and hence, my FPS? To verify that my OpenCV installation allows GPU processing, I have used the following statements with the respective outputs.
cv2.cuda.getCudaEnabledDeviceCount()
Output 1.
cv2.getBuildInformation()
Output: '\nGeneral configuration for OpenCV 4.4.0 =====================================\n Version control: unknown\n\n Extra modules:\n Location (extra): G:/opencv_contrib-4.4.0/opencv_contrib-4.4.0/modules\n Version control (extra): unknown\n\n Platform:\n Timestamp: 2021-09-24T15:28:43Z\n Host: Windows 10.0.19043 AMD64\n CMake: 3.21.1\n CMake generator: Visual Studio 16 2019\n CMake build tool: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe\n MSVC: 1929\n\n CPU/HW features:\n Baseline: SSE SSE2 SSE3\n requested: SSE3\n Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX\n requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX\n SSE4_1 (17 files): + SSSE3 SSE4_1\n SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2\n FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX\n AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX\n AVX2 (31 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2\n AVX512_SKX (7 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX\n\n C/C++:\n Built as dynamic libs?: YES\n C++ standard: 11\n C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe (ver 19.29.30133.0)\n C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP /MD /O2 /Ob2 /DNDEBUG \n C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP /MDd /Zi /Ob0 /Od /RTC1 \n C Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe\n C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /MP /MD /O2 /Ob2 /DNDEBUG \n C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /MP /MDd /Zi /Ob0 /Od /RTC1 \n Linker flags (Release): /machine:x64 /INCREMENTAL:NO \n Linker flags (Debug): /machine:x64 /debug /INCREMENTAL \n ccache: NO\n Precompiled headers: NO\n Extra dependencies: cudart_static.lib nppc.lib nppial.lib nppicc.lib nppicom.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cudnn.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/lib/x64\n 3rdparty dependencies:\n\n OpenCV modules:\n To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab world xfeatures2d ximgproc xobjdetect xphoto\n Disabled: -\n Disabled by dependency: -\n Unavailable: alphamat cnn_3dobj cvv freetype hdf java js julia matlab ovis python2 python2 sfm viz\n Applications: tests perf_tests apps\n Documentation: NO\n Non-free algorithms: NO\n\n Windows RT support: NO\n\n GUI: \n Win32 UI: YES\n VTK support: NO\n\n Media I/O: \n ZLib: build (ver 1.2.11)\n JPEG: build-libjpeg-turbo (ver 2.0.5-62)\n WEBP: build (ver encoder: 0x020f)\n PNG: build (ver 1.6.37)\n TIFF: build (ver 42 - 4.0.10)\n JPEG 2000: build Jasper (ver 1.900.1)\n OpenEXR: build (ver 2.3.0)\n HDR: YES\n SUNRASTER: YES\n PXM: YES\n PFM: YES\n\n Video I/O:\n DC1394: NO\n FFMPEG: YES (prebuilt binaries)\n avcodec: YES (58.54.100)\n avformat: YES (58.29.100)\n avutil: YES (56.31.100)\n swscale: YES (5.5.100)\n avresample: YES (4.0.0)\n GStreamer: NO\n DirectShow: YES\n Media Foundation: YES\n DXVA: YES\n\n Parallel framework: Concurrency\n\n Trace: YES (with Intel ITT)\n\n Other third-party libraries:\n Intel IPP: 2020.0.0 Gold [2020.0.0]\n at: G:/opencv-gpu-build/3rdparty/ippicv/ippicv_win/icv\n Intel IPP IW: sources (2020.0.0)\n at: G:/opencv-gpu-build/3rdparty/ippicv/ippicv_win/iw\n Lapack: NO\n Eigen: NO\n Custom HAL: NO\n Protobuf: build (3.5.1)\n\n NVIDIA CUDA: YES (ver 10.1, CUFFT CUBLAS FAST_MATH)\n NVIDIA GPU arch: 50\n NVIDIA PTX archs:\n\n cuDNN: YES (ver 7.6.5)\n\n OpenCL: YES (NVD3D11)\n Include path: G:/opencv-4.4.0/opencv-4.4.0/3rdparty/include/opencl/1.2\n Link libraries: Dynamic load\n\n Python 3:\n Interpreter: G:/python-projects/human-pose-estimation/venv/Scripts/python.exe (ver 3.9.6)\n Libraries: C:/Users/tmakp/AppData/Local/Programs/Python/Python39/libs/python39.lib (ver 3.9.6)\n numpy: G:/python-projects/human-pose-estimation/venv/Lib/site-packages/numpy/core/include (ver 1.21.2)\n install path: G:/python-projects/human-pose-estimation/venv/Lib/site-packages/cv2/python-3.9\n\n Python (for build): G:/python-projects/human-pose-estimation/venv/Scripts/python.exe\n\n Java: \n ant: NO\n JNI: NO\n Java wrappers: NO\n Java tests: NO\n\n Install to: G:/opencv-gpu-build/install\n-----------------------------------------------------------------\n\n'