cuda-chen / opencv-dnn-cuda-test Goto Github PK
View Code? Open in Web Editor NEWSample code of testing functions of OpenCV with CUDA-enabled DNN modules.
License: MIT License
Sample code of testing functions of OpenCV with CUDA-enabled DNN modules.
License: MIT License
Hi there,
Thanks for this repo to test out CUDA with DNN. I have built OpenCV 4.4.0 on Ubuntu 20.04 LTS and the Python verification works.
However, I am unable to build main.cpp under cpp_code directory. I am not a C++ programmer, but I would like to ensure that the all tests works fine. When I build as per README.md:
g++ -o opencv_dnn_cuda_test_cpp main.cpp -I/usr/local/include/opencv4 -lopencv_core -lopencv_dnn -lopencv_highgui -lopencv_imgcodecs
.. I get lots of linking errors, like complaining about OpenCL:
usr/bin/ld: /usr/local/lib/libopencv_core.a(opencl_core.cpp.o): in function `opencl_check_fn(int)':
opencl_core.cpp:(.text._ZL15opencl_check_fni+0x3f): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL15opencl_check_fni+0x11a): undefined reference to `dlopen'
/usr/bin/ld: opencl_core.cpp:(.text._ZL15opencl_check_fni+0x131): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL15opencl_check_fni+0x19d): undefined reference to `dlopen'
/usr/bin/ld: opencl_core.cpp:(.text._ZL15opencl_check_fni+0x1b4): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL15opencl_check_fni+0x1ea): undefined reference to `dlclose'
/usr/bin/ld: opencl_core.cpp:(.text._ZL15opencl_check_fni+0x227): undefined reference to `dlclose'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(opencl_core.cpp.o): in function `OPENCL_FN_clUnloadCompiler_switch_fn()':
opencl_core.cpp:(.text._ZL36OPENCL_FN_clUnloadCompiler_switch_fnv+0x32): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clUnloadCompiler_switch_fnv+0x10b): undefined reference to `dlopen'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clUnloadCompiler_switch_fnv+0x122): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clUnloadCompiler_switch_fnv+0x18e): undefined reference to `dlopen'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clUnloadCompiler_switch_fnv+0x1a5): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clUnloadCompiler_switch_fnv+0x1db): undefined reference to `dlclose'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clUnloadCompiler_switch_fnv+0x218): undefined reference to `dlclose'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(opencl_core.cpp.o): in function `OPENCL_FN_clReleaseSampler_switch_fn(_cl_sampler*)':
opencl_core.cpp:(.text._ZL36OPENCL_FN_clReleaseSampler_switch_fnP11_cl_sampler+0x37): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clReleaseSampler_switch_fnP11_cl_sampler+0x113): undefined reference to `dlopen'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clReleaseSampler_switch_fnP11_cl_sampler+0x12a): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clReleaseSampler_switch_fnP11_cl_sampler+0x196): undefined reference to `dlopen'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clReleaseSampler_switch_fnP11_cl_sampler+0x1ad): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clReleaseSampler_switch_fnP11_cl_sampler+0x1e3): undefined reference to `dlclose'
/usr/bin/ld: opencl_core.cpp:(.text._ZL36OPENCL_FN_clReleaseSampler_switch_fnP11_cl_sampler+0x220): undefined reference to `dlclose'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(opencl_core.cpp.o): in function `OPENCL_FN_clUnloadPlatformCompiler_switch_fn(_cl_platform_id*)':
opencl_core.cpp:(.text._ZL44OPENCL_FN_clUnloadPlatformCompiler_switch_fnP15_cl_platform_id+0x37): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL44OPENCL_FN_clUnloadPlatformCompiler_switch_fnP15_cl_platform_id+0x113): undefined reference to `dlopen'
/usr/bin/ld: opencl_core.cpp:(.text._ZL44OPENCL_FN_clUnloadPlatformCompiler_switch_fnP15_cl_platform_id+0x12a): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL44OPENCL_FN_clUnloadPlatformCompiler_switch_fnP15_cl_platform_id+0x196): undefined reference to `dlopen'
/usr/bin/ld: opencl_core.cpp:(.text._ZL44OPENCL_FN_clUnloadPlatformCompiler_switch_fnP15_cl_platform_id+0x1ad): undefined reference to `dlsym'
/usr/bin/ld: opencl_core.cpp:(.text._ZL44OPENCL_FN_clUnloadPlatformCompiler_switch_fnP15_cl_platform_id+0x1e3): undefined reference to `dlclose'
/usr/bin/ld: opencl_core.cpp:(.text._ZL44OPENCL_FN_clUnloadPlatformCompiler_switch_fnP15_cl_platform_id+0x220): undefined reference to `dlclose'
.. to:
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::details::TlsAbstraction::~TlsAbstraction()':
system.cpp:(.text._ZN2cv7details14TlsAbstractionD2Ev+0x8): undefined reference to `pthread_key_delete'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::details::TlsAbstraction::getData_() const':
system.cpp:(.text._ZNK2cv7details14TlsAbstraction8getData_Ev+0x7): undefined reference to `pthread_getspecific'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::ipp::IPPInitSingleton::IPPInitSingleton()':
system.cpp:(.text._ZN2cv3ipp16IPPInitSingletonC2Ev[_ZN2cv3ipp16IPPInitSingletonC5Ev]+0x65): undefined reference to `ippicvGetCpuFeatures'
/usr/bin/ld: system.cpp:(.text._ZN2cv3ipp16IPPInitSingletonC2Ev[_ZN2cv3ipp16IPPInitSingletonC5Ev]+0x3fc): undefined reference to `ippicvInit'
/usr/bin/ld: system.cpp:(.text._ZN2cv3ipp16IPPInitSingletonC2Ev[_ZN2cv3ipp16IPPInitSingletonC5Ev]+0x401): undefined reference to `ippicvGetEnabledCpuFeatures'
/usr/bin/ld: system.cpp:(.text._ZN2cv3ipp16IPPInitSingletonC2Ev[_ZN2cv3ipp16IPPInitSingletonC5Ev]+0x448): undefined reference to `ippicviGetLibVersion'
/usr/bin/ld: system.cpp:(.text._ZN2cv3ipp16IPPInitSingletonC2Ev[_ZN2cv3ipp16IPPInitSingletonC5Ev]+0x531): undefined reference to `ippicvSetCpuFeatures'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::details::TlsAbstraction::TlsAbstraction()':
system.cpp:(.text._ZN2cv7details14TlsAbstractionC2Ev+0x22): undefined reference to `pthread_key_create'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::details::TlsAbstraction::setData_(void*)':
system.cpp:(.text._ZN2cv7details14TlsAbstraction8setData_EPv+0x1c): undefined reference to `pthread_setspecific'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::details::getTlsAbstraction()':
system.cpp:(.text._ZN2cv7detailsL17getTlsAbstractionEv+0xaf): undefined reference to `pthread_key_create'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::details::opencv_tls_destructor(void*)':
system.cpp:(.text._ZN2cv7detailsL21opencv_tls_destructorEPv+0x1c4): undefined reference to `pthread_getspecific'
/usr/bin/ld: system.cpp:(.text._ZN2cv7detailsL21opencv_tls_destructorEPv+0x1eb): undefined reference to `pthread_setspecific'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::TLSData<cv::(anonymous namespace)::ThreadID>::createDataInstance() const':
system.cpp:(.text._ZNK2cv7TLSDataINS_12_GLOBAL__N_18ThreadIDEE18createDataInstanceEv+0x50): undefined reference to `__itt_thread_set_name_ptr__3_0'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::TLSDataContainer::getData() const':
system.cpp:(.text._ZNK2cv16TLSDataContainer7getDataEv+0x58): undefined reference to `pthread_getspecific'
/usr/bin/ld: system.cpp:(.text._ZNK2cv16TLSDataContainer7getDataEv+0xe3): undefined reference to `pthread_getspecific'
/usr/bin/ld: system.cpp:(.text._ZNK2cv16TLSDataContainer7getDataEv+0x1a4): undefined reference to `pthread_setspecific'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(system.cpp.o): in function `cv::TLSDataContainer::getData() const [clone .constprop.0]':
system.cpp:(.text._ZNK2cv16TLSDataContainer7getDataEv.constprop.0+0x54): undefined reference to `pthread_getspecific'
/usr/bin/ld: system.cpp:(.text._ZNK2cv16TLSDataContainer7getDataEv.constprop.0+0xdb): undefined reference to `pthread_getspecific'
/usr/bin/ld: system.cpp:(.text._ZNK2cv16TLSDataContainer7getDataEv.constprop.0+0x194): undefined reference to `pthread_setspecific'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(trace.cpp.o): in function `cv::utils::trace::details::isITTEnabled()':
trace.cpp:(.text._ZN2cv5utils5trace7detailsL12isITTEnabledEv+0x88): undefined reference to `__itt_api_version_ptr__3_0'
/usr/bin/ld: trace.cpp:(.text._ZN2cv5utils5trace7detailsL12isITTEnabledEv+0x9f): undefined reference to `__itt_domain_create_ptr__3_0'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(trace.cpp.o): in function `cv::utils::trace::details::Region::LocationExtraData::LocationExtraData(cv::utils::trace::details::Region::LocationStaticStorage const&)':
trace.cpp:(.text._ZN2cv5utils5trace7details6Region17LocationExtraDataC2ERKNS3_21LocationStaticStorageE+0x3b): undefined reference to `__itt_string_handle_create_ptr__3_0'
/usr/bin/ld: trace.cpp:(.text._ZN2cv5utils5trace7details6Region17LocationExtraDataC2ERKNS3_21LocationStaticStorageE+0x118): undefined reference to `__itt_api_version_ptr__3_0'
/usr/bin/ld: trace.cpp:(.text._ZN2cv5utils5trace7details6Region17LocationExtraDataC2ERKNS3_21LocationStaticStorageE+0x130): undefined reference to `__itt_domain_create_ptr__3_0'
/usr/bin/ld: /usr/local/lib/libopencv_core.a(trace.cpp.o): in function `cv::utils::trace::details::Region::Impl::~Impl()':
Can you suggest where I should start looking at what the problem is ?
Line 9 of main.py has:
But the file yolov3.weights is not anywhere in the repository.
Thus, executing the python test fails:
(opencv_cuda) jsalvo@rig01:~/projects/opencv-dnn-cuda-test/python_code$ python main.py
Traceback (most recent call last):
File "main.py", line 9, in <module>
net = cv.dnn.readNet(model="../yolos/yolov3.weights", config="../yolos/yolov3.cfg")
cv2.error: OpenCV(4.4.0) /home/jsalvo/projects/opencv/modules/dnn/src/darknet/darknet_importer.cpp:214: error: (-212:Parsing error) Failed to parse NetParameter file: ../yolos/yolov3.weights in function 'readNetFromDarknet'
i found this issue need ure help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.