-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Add additional image processing operators for Ascend NPU by utilizing DVPP #3608
Conversation
95a6756
to
15bf9bd
Compare
@opencv-alalek Happy New Year! This PR relies on CANN backends, could you trigger the test by labelling it? BTW, it may fail until the library it needs is linked. (Link libacl_dvpp_mpi library when building with CANN backend #24720) The build on win64 is scheduled, and I have no idea with how to deal this. |
Windows builder worker was paused due to maintenance. Ignore. I added "cann" label but GHA doesn't launch CANN build configuration due to some reason. If you want to test both PRs/patches from |
Thx, are there any errors with the CI machine or bugs on GHA?
Got it, I will resubmit a PR in |
Good Day! @opencv-alalek, Thanks for your help, now CANN's CI is working properly and this PR passed all the checks. Could you please help review this PR or assign someone else to review it? This PR is mainly based on #3552 with the new operators utilizing DVPP for Ascend NPU, providing more interpolation methods for |
/cc @fengyuentau |
modules/cannops/src/dvpp_call.cpp
Outdated
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html. | ||
#ifndef ENABLE_DVPP_INTERFACE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this check in .cpp file?
If yes, then I expecting #endif
much closer (like modules/cannops/include/opencv2/dvpp_call.hpp)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it will be deleted in next commit. Thanks for the correction
holder.clear(); | ||
return *this; | ||
} | ||
void initDvpp() { hi_mpi_sys_init(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What devices are supported here? I see from the document that
Atlas 200/300/500 推理产品,不支持该接口
Also it turns out these are from dvpp v2. In dvpp v1, there is no such a thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What devices are supported here? I see from the document that
Atlas 200/300/500 推理产品,不支持该接口
Atlas Inference Series products, Atlas 200/500 A2 Inference products and Atlas A2 Training Series products/Atlas 300I A2 Inference products are supported. The detailed information can be found in the official documentation in 功能支持度说明
. Thank you for the suggestion, the description about supported devices is very important for users, this information will be clearly clarified in the form of a comment in the next commit.
Also it turns out these are from dvpp v2. In dvpp v1, there is no such a thing.
The Ascend official documentation indicates that the DVPP V2 version of the interface is recommended. DVPP V1 version is only compatible with older versions and will not be evolved in the future, so DVPP V2 is used to follow the future evolution.
a15b091
to
1386f6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
1386f6b
to
bc7b529
Compare
Thanks for the review! All the fixes, as well as the cherry-pick have been done now. |
1. add the Ascend dvpp calling code 2. add copyMakeBorder, cropResize and cropResizeMakeBorder 3. add resize with INTER_LINEAR and INTER_NEAREST interpolation
bc7b529
to
866b914
Compare
@asmorkalov Good Day! Should the code in this PR be included in the branch? |
@asmorkalov Sorry to bother you, could you check if this project is now mergeable? |
Hello @MengqingCao , could you help resolve comments in opencv-infrastructure/opencv-gha-dockerfile#28? |
sure, I'll check it soon. |
@asmorkalov Sorry to bother you again, could you please review whether this pull request should be included? thx 👍 |
@fengyuentau @asmorkalov Good day! I noticed that the CI passed but was not updated in the build check on this page. Should the CI be retriggered or anything else to do with it? |
Add additional image processing operators for Ascend NPU by utilizing DVPP opencv#3608 The user base for [Ascend NPU](https://www.hiascend.com/en/) and programming with CANN is increasing rapidly, with a growing number of users joining each day. To facilitate the use of these users, this PR provides more support for Ascend backend operators. All operators this PR offers are using use DVPP as the computational unit. Digital Vision Pre-Processing (DVPP) is an image processing unit built into the Ascend AI processor. Its main functions include image and video encoding/decoding, as well as image cropping and scaling. The high-frequency operators with NPU as the backend and basic data structure AscendMat has been provided in opencv#3552, while it still lacks many image processing operators. Moreover, only two interpolation algorithms for the resize operator are supported in opencv#3552. In this PR, the bilinear interpolation algorithm and nearest neighbour interpolation algorithm are implemented for the resize operator, as well as the Ascend implementation of the copyMakeBorder operator. In addition, the serialization of image processing operations is widely used in the preprocessing and post-processing stages of computer vision deep learning methods. Therefore, providing integrated operators is very meaningful for improving the convenience of use for OpenCV and deep learning crossover users. For example, torchvision also provides similar operators: [RESIZED_CROP](https://pytorch.org/vision/stable/generated/torchvision.transforms.functional.resized_crop.html?highlight=resizedcrop). Thus, this PR also provides two serialization processing operators: cropResize and cropResizeMakeBorder. ### 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 - [N/A] 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
The user base for Ascend NPU and programming with CANN is increasing rapidly, with a growing number of users joining each day. To facilitate the use of these users, this PR provides more support for Ascend backend operators. All operators this PR offers are using use DVPP as the computational unit. Digital Vision Pre-Processing (DVPP) is an image processing unit built into the Ascend AI processor. Its main functions include image and video encoding/decoding, as well as image cropping and scaling.
The high-frequency operators with NPU as the backend and basic data structure AscendMat has been provided in #3552, while it still lacks many image processing operators. Moreover, only two interpolation algorithms for the resize operator are supported in #3552. In this PR, the bilinear interpolation algorithm and nearest neighbour interpolation algorithm are implemented for the resize operator, as well as the Ascend implementation of the copyMakeBorder operator.
In addition, the serialization of image processing operations is widely used in the preprocessing and post-processing stages of computer vision deep learning methods. Therefore, providing integrated operators is very meaningful for improving the convenience of use for OpenCV and deep learning crossover users. For example, torchvision also provides similar operators: RESIZED_CROP.
Thus, this PR also provides two serialization processing operators: cropResize and cropResizeMakeBorder.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.