Skip to content

Added TF nearest neighbour resize behaviour alignment#19071

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
LupusSanctus:am/dnn_nearest_resize_3.4
Dec 11, 2020
Merged

Added TF nearest neighbour resize behaviour alignment#19071
opencv-pushbot merged 1 commit intoopencv:3.4from
LupusSanctus:am/dnn_nearest_resize_3.4

Conversation

@LupusSanctus
Copy link
Copy Markdown

@LupusSanctus LupusSanctus commented Dec 10, 2020

Relates to OpenCV issue #18721

Merge with extra: opencv/opencv_extra#830

Added support of TF nearest neighbour resize cases: align_corners=False, half_pixel_centers=True, align_corners=True, half_pixel_centers=False.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=Custom,Custom Win,Custom Mac
build_image:Custom=ubuntu-openvino-2021.1.0:20.04
build_image:Custom Win=openvino-2021.1.0
build_image:Custom Mac=openvino-2021.1.0

test_modules:Custom=dnn,python2,python3,java
test_modules:Custom Win=dnn,python2,python3,java
test_modules:Custom Mac=dnn,python2,python3,java

buildworker:Custom=linux-1
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

@LupusSanctus LupusSanctus force-pushed the am/dnn_nearest_resize_3.4 branch from 32052a0 to f2422ac Compare December 10, 2020 12:55
@GArik GArik requested a review from dkurt December 10, 2020 13:01
@LupusSanctus
Copy link
Copy Markdown
Author

LupusSanctus commented Dec 10, 2020

FYI: tried to cover align_corners=False, half_pixel_centers=True case using cv::resize INTER_NEAREST_EXACT. It worked fine, however, for example, case with 10x11 input and its scale into 15x13 the result were different. In #17068 PR, I've found the demo script and modified it for the following check: cv::resize INTER_NEAREST_EXACT vs PIL vs Skimage vs TF (align_corners=False, half_pixel_centers=True). It works as expected for 10x11 => 14x12 (outputs are equal) and behaviour changes for 10x11 => 15x13 (all outputs are different):
https://raw.githubusercontent.com/LupusSanctus/opencv/am/test_script/resize_test/nearest_resize_test_out.txt

However, judging by code, it seems that such INTER_NEAREST_EXACT behaviour is expected.

Copy link
Copy Markdown
Member

@dkurt dkurt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contribution!

Just wanted to let you know that commits are signed by different email which is not attached to your GitHub profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants