mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge pull request #26124 from fengyuentau:dnn/topk_dtype
dnn(5.x): handle topk data type #26124 Resolves https://github.com/opencv/opencv/issues/26076 ### 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
This commit is contained in:
@@ -395,7 +395,7 @@
|
||||
"test_tfidfvectorizer_tf_uniandbigrams_skip5", // Issue:: Parser: Can't create layer "onnx_node_output_0!Y" of type "TfIdfVectorizer" in function 'getLayerInstance'
|
||||
"test_tile", // Issue:: Parser: ONNX/Tile: repeats being non-constant is not supported. in function 'parseTile' (layer parameters are dynamic)
|
||||
"test_tile_precomputed", // // ---- same as above ---
|
||||
"test_top_k", // Issue:: Parser: Can't create layer "onnx_node_output_0!values" of type "TopK" in function 'getLayerInstance'
|
||||
"test_top_k", // Issue:: K being input is not compatible with the current engine
|
||||
"test_top_k_negative_axis", // ---- same as above ---
|
||||
"test_top_k_smallest", // ---- same as above ---
|
||||
"test_training_dropout", // Issue::cvtest::norm::wrong data type
|
||||
|
||||
@@ -3278,8 +3278,12 @@ TEST_P(Test_ONNX_layers, ClipDivSharedConstant) {
|
||||
testONNXModels("clip_div_shared_constant");
|
||||
}
|
||||
|
||||
// Bug: https://github.com/opencv/opencv/issues/26076
|
||||
TEST_P(Test_ONNX_layers, DISABLED_TopK) {
|
||||
TEST_P(Test_ONNX_layers, TopK) {
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH ||
|
||||
backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 ||
|
||||
backend == DNN_BACKEND_INFERENCE_ENGINE) {
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE); // OpenVINO does not support int64
|
||||
}
|
||||
auto test = [&](const std::string &basename, double l1 = 0, double lInf = 0) {
|
||||
std::string onnxmodel = _tf("models/" + basename + ".onnx", true);
|
||||
Mat input = readTensorFromONNX(_tf("data/input_" + basename + ".pb"));
|
||||
@@ -3299,8 +3303,6 @@ TEST_P(Test_ONNX_layers, DISABLED_TopK) {
|
||||
Mat output_res_val = outputs.front(),
|
||||
output_res_ind = outputs.back();
|
||||
|
||||
output_ref_ind.convertTo(output_ref_ind, CV_32F); // TODO: revise this conversion in 5.x
|
||||
|
||||
normAssert(output_ref_val, output_res_val, (basename + " values").c_str(), l1 ? l1 : default_l1, lInf ? lInf : default_lInf);
|
||||
normAssert(output_ref_ind, output_res_ind, (basename + " indices").c_str(), l1 ? l1 : default_l1, lInf ? lInf : default_lInf);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user