Skip to content

cudaarithm: inplace version of NPP flip fails with odd number ROI #18347

@tomoaki0705

Description

@tomoaki0705
System information (version)
  • OpenCV => recent 3.4 (8cb7eae) / master (3b00ee2)
  • Operating System / Platform => Jetson Nano/TX1/TX2/XavierNX
  • Compiler => GCC 5.4.0, GCC 7.5.0
  • CUDA => 10.0 (Nano) 10.2 (XavierNX) 8.0 (TX1,TX2)
Detailed description

This issue was originally found by @nglee
The in-place version of mirror was enabled in #17863
Unfortunately, the test intermittently fails.

./opencv_test_cudaarithm
(snip)
[ RUN      ] CUDA_Arithm/Flip.AccuracyInplace/82, where GetParam() = (NVIDIA Tegra X1, 113x113, 8UC3, FLIP_Y, whole matrix)
/home/nvidia/opencv-fork/modules/cudaarithm/test/test_core.cpp:292: Failure
The max difference between matrices "dst_gold" and "srcDst" is 243 at (56, 102), which exceeds "0.0", where "dst_gold" at (56, 102) evaluates to (84, 129, 2), "srcDst" at (56, 102) evaluates to (147, 171, 245), "0.0" evaluates to 0
[  FAILED  ] CUDA_Arithm/Flip.AccuracyInplace/82, where GetParam() = (NVIDIA Tegra X1, 113x113, 8UC3, FLIP_Y, whole matrix) (2 ms)
(snip)
[  PASSED  ] 11169 tests.
[  FAILED  ] 4 tests, listed below:
[  FAILED  ] CUDA_Arithm/Flip.AccuracyInplace/82, where GetParam() = (NVIDIA Tegra X1, 113x113, 8UC3, FLIP_Y, whole matrix)
[  FAILED  ] CUDA_Arithm/Flip.AccuracyInplace/88, where GetParam() = (NVIDIA Tegra X1, 113x113, 8UC4, FLIP_Y, whole matrix)
[  FAILED  ] CUDA_Arithm/Flip.AccuracyInplace/106, where GetParam() = (NVIDIA Tegra X1, 113x113, 16UC4, FLIP_Y, whole matrix)
[  FAILED  ] CUDA_Arithm/Flip.AccuracyInplace/142, where GetParam() = (NVIDIA Tegra X1, 113x113, 32FC4, FLIP_Y, whole matrix)

 4 FAILED TESTS

I was able to reproduce it separate from OpenCV, so the cause came from NPP
I contacted with NPP team, and I got reply that

  • There was a synchronization issue in in-place version
  • The NPP team chose not to fix this, but instead, in the future release, this in-place function will explicitly return an error value NPP_SIZE_ERROR when width and/or height is odd number
    I think I need to add the same limit in the cv::cuda::flip

I'll send a patch shortly

Steps to reproduce

run ./opencv_test_cudaarithm

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions