Skip to content

dnn: inference results are different from ONNX Runtime on the InstanceNorm layer #24377

@fengyuentau

Description

@fengyuentau

System Information

latest opencv

Detailed description

Relates #24092 (comment)

TEST_P(Test_ONNX_layers, InstanceNormEpsilon) {
    testONNXModels("test_instancenorm_epsilon", pb);
}
TEST_P(Test_ONNX_layers, InstanceNormExample) {
    testONNXModels("test_instancenorm_example", pb);
}
$ ./build/bin/opencv_test_dnn --gtest_filter="Test_ONNX_layers.InstanceNorm*"
CTEST_FULL_OUTPUT
OpenCV version: 4.8.0-dev
OpenCV VCS version: 4.8.0-299-g590f150d5e
Build type: Release
Compiler: /usr/bin/c++  (ver 9.4.0)
Parallel framework: pthreads (nthreads=6)
CPU features: SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16? *AVX *AVX2 *AVX512-SKX?
Intel(R) IPP version: ippIP SSE4.2 (y8) 2021.8 (-) Feb 20 2023
Intel(R) IPP features code: 0x80
OpenCL is disabled
TEST: Skip tests with tags: 'mem_6gb', 'verylong', 'dnn_skip_opencv_backend', 'dnn_skip_cpu', 'dnn_skip_cpu_fp16', 'dnn_skip_ocl', 'dnn_skip_ocl_fp16', 'dnn_skip_onnx_conformance', 'dnn_skip_parser'
Note: Google Test filter = Test_ONNX_layers.InstanceNorm*
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from Test_ONNX_layers
[ RUN      ] Test_ONNX_layers.InstanceNorm/0, where GetParam() = OCV/CPU
[       OK ] Test_ONNX_layers.InstanceNorm/0 (1 ms)
[ RUN      ] Test_ONNX_layers.InstanceNormEpsilon/0, where GetParam() = OCV/CPU
/home/tao/workspace/fytao/workspace/instance_norm/opencv/modules/dnn/test/test_common.impl.hpp:76: Failure
Expected: (normL1) <= (l1), actual: 0.632857 vs 1e-05
test_instancenorm_epsilon  |ref| = 2.7365410327911377
/home/tao/workspace/fytao/workspace/instance_norm/opencv/modules/dnn/test/test_common.impl.hpp:79: Failure
Expected: (normInf) <= (lInf), actual: 4.001 vs 0.0001
test_instancenorm_epsilon  |ref| = 2.7365410327911377
[  FAILED  ] Test_ONNX_layers.InstanceNormEpsilon/0, where GetParam() = OCV/CPU (0 ms)
[ RUN      ] Test_ONNX_layers.InstanceNormExample/0, where GetParam() = OCV/CPU
[ERROR:0@0.018] global onnx_importer.cpp:1029 handleNode DNN/ONNX: ERROR during processing node with 3 inputs and 1 outputs: [InstanceNormalization]:(onnx_node_output_0!y) from domain='ai.onnx'
unknown file: Failure
C++ exception with description "OpenCV(4.8.0-dev) /home/tao/workspace/fytao/workspace/instance_norm/opencv/modules/dnn/src/onnx/onnx_importer.cpp:1051: error: (-2:Unspecified error) in function 'handleNode'
> Node [InstanceNormalization@ai.onnx]:(onnx_node_output_0!y) parse error: OpenCV(4.8.0-dev) /home/tao/workspace/fytao/workspace/instance_norm/opencv/modules/dnn/include/opencv2/dnn/dnn.inl.hpp:350: error: (-204:Requested object was not found) Required argument "epsilon" not found into dictionary in function 'get'
> " thrown in the test body.
[  FAILED  ] Test_ONNX_layers.InstanceNormExample/0, where GetParam() = OCV/CPU (1 ms)
[----------] 3 tests from Test_ONNX_layers (2 ms total)

[----------] Global test environment tear-down
[==========] 3 tests from 1 test case ran. (2 ms total)
[  PASSED  ] 1 test.
[  FAILED  ] 2 tests, listed below:
[  FAILED  ] Test_ONNX_layers.InstanceNormEpsilon/0, where GetParam() = OCV/CPU
[  FAILED  ] Test_ONNX_layers.InstanceNormExample/0, where GetParam() = OCV/CPU

 2 FAILED TESTS

Test models and data are collected from ONNX conformance tests. They are converted to the form that opencv dnn tests use.

Steps to reproduce

  1. Prepare opencv with the above test code, build target opencv_test_dnn.
  2. Prepare opencv_extra with all.zip.
  3. Set environment and run the test with ./build/bin/opencv_test_dnn --gtest_filter="Test_ONNX_layers.InstanceNorm*".

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions