dnn: fix HAVE_TIMVX macro definition in dnn test#24425
dnn: fix HAVE_TIMVX macro definition in dnn test#24425asmorkalov merged 3 commits intoopencv:4.xfrom
Conversation
modules/dnn/CMakeLists.txt
Outdated
| ocv_option(OPENCV_TEST_DNN_TIMVX "Build test with TIM-VX" (TARGET ocv.3rdparty.timvx)) | ||
| if(TARGET ocv.3rdparty.timvx AND OPENCV_TEST_DNN_TIMVX) | ||
| if(TARGET opencv_test_dnn) | ||
| ocv_target_link_libraries(opencv_test_dnn ocv.3rdparty.timvx) |
There was a problem hiding this comment.
Why do you need it? It's internal detail of implementation and user code should not depend on it, including tests. libopencv_dnn should have dependency from TIMVX.
There was a problem hiding this comment.
Test does not work with missing HAVE_TIMVX macro:
opencv/modules/dnn/test/test_int8_layers.cpp
Lines 11 to 22 in 240b245
Basically I need HAVE_TIMVX=1.
There was a problem hiding this comment.
We don't need that.
There is registry API:
opencv/modules/dnn/include/opencv2/dnn/dnn.hpp
Lines 125 to 126 in 240b245
And usage in tests:
opencv/modules/dnn/test/test_common.impl.hpp
Lines 291 to 296 in 240b245
There was a problem hiding this comment.
DNN_BACKEND_TIMVX is not in opencv/modules/dnn/test/test_common.impl.hpp.
|
The mentioned macro is used in tests in 2 places and both of them may be replaced with runtime check like Alexander suggested. |
|
So why these happen? See opencv/modules/dnn/CMakeLists.txt Lines 290 to 295 in 6e4280e and opencv/modules/dnn/test/test_int8_layers.cpp Lines 11 to 22 in 6e4280e (see line 18). The TIM-VX backend is only for int8-quantized models. |
|
Also @asmorkalov could you provide a key via email for me to set up a GitHub Actions connection with my Khadas VIM3? |
Because tests use OpenVINO API directly to test IR models (as a reference result). opencv/modules/dnn/test/test_ie_models.cpp Lines 185 to 210 in 6e4280e Tests doesn't use special TIM-VX API |
modules/dnn/CMakeLists.txt
Outdated
| ocv_option(OPENCV_TEST_DNN_TIMVX "Build test with TIM-VX" (HAVE_TIMVX)) | ||
| if(OPENCV_TEST_DNN_TIMVX) | ||
| if(TARGET opencv_test_dnn) | ||
| ocv_target_compile_definitions(opencv_test_dnn PRIVATE "HAVE_TIMVX=1") |
There was a problem hiding this comment.
Thank you for finding this! Meanwhile please hold merging this PR until the hardware is in the CI running the tests.
|
The log shows tim-vx backend works fine with this patch, https://github.com/opencv/opencv/actions/runs/6586141510/job/17893901244?pr=24425 Ready to be merged once all tests are done. |
|
@fengyuentau I see VIM3 build passed on CI. Is it ready? May I merge the pr? |
Yes, it is ready and you can merge it. |
dnn: fix HAVE_TIMVX macro definition in dnn test opencv#24425 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
dnn: fix HAVE_TIMVX macro definition in dnn test opencv#24425 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
dnn: fix HAVE_TIMVX macro definition in dnn test opencv#24425 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.