Skip to content

GAPI: Move Resize kernel from core to imgproc #21157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 29, 2021

Conversation

alexgiving
Copy link
Member

@alexgiving alexgiving commented Nov 30, 2021

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_gapi_standalone:Linux x64=ade-0.1.1f
build_gapi_standalone:Win64=ade-0.1.1f
build_gapi_standalone:Mac=ade-0.1.1f
build_gapi_standalone:Linux x64 Debug=ade-0.1.1f

Xbuild_image:Custom=centos:7
Xbuildworker:Custom=linux-1
build_gapi_standalone:Custom=ade-0.1.1f

build_image:Custom=ubuntu-openvino-2021.4.1:20.04
build_image:Custom Win=openvino-2021.4.1
build_image:Custom Mac=openvino-2021.4.1

test_modules:Custom=gapi,python2,python3,java
test_modules:Custom Win=gapi,python2,python3,java
test_modules:Custom Mac=gapi,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=*

@alexgiving alexgiving force-pushed the atrutnev/move_resize branch from 25ca3e4 to 2fd2b0b Compare December 1, 2021 12:45
@anna-khakimova anna-khakimova self-requested a review December 2, 2021 13:08
Comment on lines +501 to +502
if (sz.width != 0 && sz.height != 0)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (sz.width != 0 && sz.height != 0)
{
if (sz.width != 0 && sz.height != 0) {

Copy link
Member

@alalek alalek Dec 3, 2021

Choose a reason for hiding this comment

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

Existed coding style is fine.
There is no Java.

Please use "Google" or "WebKit" style from clang-format

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought it would be good to align the code style in the file.
There are both variants ) { and ) enter { in file.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will follow the ) enter { style through the files. Thanks @mpashchenkov

Comment on lines +504 to +506
}
else
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
else
{
} else {

@@ -18,6 +18,42 @@ namespace
namespace opencv_test
{

INSTANTIATE_TEST_CASE_P(ResizeTestCPU, ResizeTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied, thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't notice the space at the end. It can be reverted to its previous condition or:
6SC1, CV_32FC1 ) --> 6SC1, CV_32FC1)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I removed both of them

cv::Size(30,30))));

INSTANTIATE_TEST_CASE_P(ResizePTestCPU, ResizePTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied, thanks

cv::Size(30,30))));

INSTANTIATE_TEST_CASE_P(ResizeTestCPU, ResizeTestFxFy,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Copy link
Contributor

Choose a reason for hiding this comment

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

And here

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied, thanks

Copy link

Choose a reason for hiding this comment

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

@mpashchenkov this and other "debug" code were added and left for some reason. Why it should be removed during resize move from core to imgproc?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because this code was commented. And I think that reason is removing extra test cases for reduce OCV tests duration.
Commented code is unused and doesn't make sense from my point of view.

Values(-1),
Values(IMGPROC_FLUID),
Values(Tolerance_FloatRel_IntAbs(1e-5, 1).to_compare_obj()),
Values(/*cv::INTER_NEAREST,*/ cv::INTER_LINEAR/*, cv::INTER_AREA*/),
Copy link
Contributor

Choose a reason for hiding this comment

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

And here. Debug code.

@@ -17,6 +17,30 @@ namespace
namespace opencv_test
{

INSTANTIATE_TEST_CASE_P(ResizeTestGPU, ResizeTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra space

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied, thanks

cv::Size(30,30))));

INSTANTIATE_TEST_CASE_P(ResizeTestGPU, ResizeTestFxFy,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra space

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied, thanks

@@ -1,6 +1,7 @@
#include <opencv2/gapi.hpp>
#include <opencv2/gapi/core.hpp>
#include <opencv2/gapi/cpu/core.hpp>
#include <opencv2/gapi/imgproc.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the sample work correctly?

auto stream = cc.compileStreaming(cv::compile_args(cv::gapi::core::cpu::kernels()));

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to keep

#include <opencv2/gapi/core.hpp>
#include <opencv2/gapi/cpu/core.hpp>

here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied, thanks

@alexgiving alexgiving force-pushed the atrutnev/move_resize branch 2 times, most recently from c2a6890 to e8da3be Compare December 7, 2021 10:34
@alexgiving alexgiving changed the title GAPI: Move Resize kernel from core to imgproc [HOLD] GAPI: Move Resize kernel from core to imgproc Dec 13, 2021
@alexgiving alexgiving changed the title [HOLD] GAPI: Move Resize kernel from core to imgproc GAPI: Move Resize kernel from core to imgproc Dec 20, 2021
@dmatveev dmatveev self-assigned this Dec 21, 2021
@dmatveev dmatveev added this to the 4.6.0 milestone Dec 21, 2021
Copy link
Contributor

@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

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

Great, thanks.

Since you've got acquainted with Resize now, can you please also have a look at #19379 ?

Copy link
Contributor

@OrestChura OrestChura left a comment

Choose a reason for hiding this comment

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

Great!

@alalek
Copy link
Member

alalek commented Dec 28, 2021

Conflicting files
modules/gapi/src/backends/fluid/gfluidcore.cpp

Need to rebase commits (relates #21339)

Copy link
Contributor

@mpashchenkov mpashchenkov left a comment

Choose a reason for hiding this comment

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

One more question.

#include <utility> // std::tuple

#include <opencv2/imgproc.hpp>
#include <opencv2/gapi/imgproc.hpp>
Copy link
Contributor

@mpashchenkov mpashchenkov Dec 29, 2021

Choose a reason for hiding this comment

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

Do this headers make sense for core?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, <opencv2/gapi/imgproc.hpp> header is necessary for backward compatibility

@@ -34,6 +34,9 @@ namespace cv { namespace gapi {
* Core module functionality.
*/
namespace core {
using GResize = cv::gapi::imgproc::GResize;
using GResizeP = cv::gapi::imgproc::GResizeP;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are GResize and GResizeP located here (in core)?

Copy link
Member Author

Choose a reason for hiding this comment

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

That aliases for backward compatibility too

@alalek alalek merged commit 43c04c2 into opencv:4.x Dec 29, 2021
@alalek alalek mentioned this pull request Dec 30, 2021
@alexgiving alexgiving mentioned this pull request Jan 10, 2022
6 tasks
@alalek alalek mentioned this pull request Feb 22, 2022
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
GAPI: Move Resize kernel from core to imgproc

* Move Resize kernel from core to imgproc

* Applied style comments

* Adding backward compatibility

* Applied Asya PR
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.

6 participants