Skip to content

Some Halide backend fixes#22656

Merged
asmorkalov merged 3 commits intoopencv:4.xfrom
dkurt:halide_fixes
Oct 21, 2022
Merged

Some Halide backend fixes#22656
asmorkalov merged 3 commits intoopencv:4.xfrom
dkurt:halide_fixes

Conversation

@dkurt
Copy link
Copy Markdown
Member

@dkurt dkurt commented Oct 18, 2022

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 another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the 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
  • Fix Halide schedulers from YAML file.
  • Do not produce extra output func for pooling if not needed
Xforce_builders=Custom
build_image:Custom=halide:16.04
buildworker:Custom=linux-4,linux-6

@asmorkalov
Copy link
Copy Markdown
Contributor

@dkurt Thanks for the patch. Could you enable some of test to cover this?

@asmorkalov asmorkalov self-requested a review October 19, 2022 06:51
@asmorkalov asmorkalov added this to the 4.7.0 milestone Oct 19, 2022
@dkurt
Copy link
Copy Markdown
Member Author

dkurt commented Oct 19, 2022

@asmorkalov, these bugs covered by existing set of tests:

./opencv_test_dnn --gtest_param_filter=*HALIDE/CPU* --gtest_filter=DNNTestNetwork* --test_tag_enable="dnn_skip_halide"

@asmorkalov
Copy link
Copy Markdown
Contributor

In docker with Ubuntu 22.04 in Docker container:

[==========] Running 20 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 20 tests from DNNTestNetwork
[ RUN      ] DNNTestNetwork.AlexNet/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.AlexNet/0 (2527 ms)
[ RUN      ] DNNTestNetwork.ResNet_50/0, where GetParam() = HALIDE/CPU
[     SKIP ] OpenCV tests: Can't find data file: dnn/ResNet-50-model.caffemodel
[       OK ] DNNTestNetwork.ResNet_50/0 (0 ms)
[ RUN      ] DNNTestNetwork.SqueezeNet_v1_1/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.SqueezeNet_v1_1/0 (1625 ms)
[ RUN      ] DNNTestNetwork.GoogLeNet/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.GoogLeNet/0 (3572 ms)
[ RUN      ] DNNTestNetwork.Inception_5h/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.Inception_5h/0 (4046 ms)
[ RUN      ] DNNTestNetwork.ENet/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.ENet/0 (5858 ms)
[ RUN      ] DNNTestNetwork.MobileNet_SSD_Caffe/0, where GetParam() = HALIDE/CPU
[     SKIP ] OpenCV tests: Can't find data file: dnn/MobileNetSSD_deploy.caffemodel
[       OK ] DNNTestNetwork.MobileNet_SSD_Caffe/0 (8 ms)
[ RUN      ] DNNTestNetwork.MobileNet_SSD_Caffe_Different_Width_Height/0, where GetParam() = HALIDE/CPU
[     SKIP ] OpenCV tests: Can't find data file: dnn/MobileNetSSD_deploy.caffemodel
[       OK ] DNNTestNetwork.MobileNet_SSD_Caffe_Different_Width_Height/0 (8 ms)
[ RUN      ] DNNTestNetwork.MobileNet_SSD_v1_TensorFlow/0, where GetParam() = HALIDE/CPU
unknown file: Failure
C++ exception with description "Error: Dimensionality mismatch accessing Buffer b3844. There were 4 arguments, but the Buffer has 3 dimensions:
  (float32)b3844(x, y, c, n)
" thrown in the test body.
[  FAILED  ] DNNTestNetwork.MobileNet_SSD_v1_TensorFlow/0, where GetParam() = HALIDE/CPU (459 ms)
[ RUN      ] DNNTestNetwork.MobileNet_SSD_v1_TensorFlow_Different_Width_Height/0, where GetParam() = HALIDE/CPU
unknown file: Failure
C++ exception with description "Error: Dimensionality mismatch accessing Buffer b4109. There were 4 arguments, but the Buffer has 3 dimensions:
  (float32)b4109(x, y, c, n)
" thrown in the test body.
[  FAILED  ] DNNTestNetwork.MobileNet_SSD_v1_TensorFlow_Different_Width_Height/0, where GetParam() = HALIDE/CPU (475 ms)
[ RUN      ] DNNTestNetwork.MobileNet_SSD_v2_TensorFlow/0, where GetParam() = HALIDE/CPU
unknown file: Failure
C++ exception with description "Error: Dimensionality mismatch accessing Buffer b4448. There were 4 arguments, but the Buffer has 3 dimensions:
  (float32)b4448(x, y, c, n)
" thrown in the test body.
[  FAILED  ] DNNTestNetwork.MobileNet_SSD_v2_TensorFlow/0, where GetParam() = HALIDE/CPU (1078 ms)
[ RUN      ] DNNTestNetwork.SSD_VGG16/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.SSD_VGG16/0 (9465 ms)
[ RUN      ] DNNTestNetwork.OpenPose_pose_coco/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.OpenPose_pose_coco/0 (5561 ms)
[ RUN      ] DNNTestNetwork.OpenPose_pose_mpi/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.OpenPose_pose_mpi/0 (5356 ms)
[ RUN      ] DNNTestNetwork.OpenPose_pose_mpi_faster_4_stages/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.OpenPose_pose_mpi_faster_4_stages/0 (3508 ms)
[ RUN      ] DNNTestNetwork.OpenFace/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.OpenFace/0 (1825 ms)
[ RUN      ] DNNTestNetwork.opencv_face_detector/0, where GetParam() = HALIDE/CPU
[       OK ] DNNTestNetwork.opencv_face_detector/0 (2446 ms)
[ RUN      ] DNNTestNetwork.Inception_v2_SSD_TensorFlow/0, where GetParam() = HALIDE/CPU
unknown file: Failure
C++ exception with description "Error: Dimensionality mismatch accessing Buffer b11096. There were 4 arguments, but the Buffer has 3 dimensions:
  (float32)b11096(x, y, c, n)
" thrown in the test body.
[  FAILED  ] DNNTestNetwork.Inception_v2_SSD_TensorFlow/0, where GetParam() = HALIDE/CPU (793 ms)
[ RUN      ] DNNTestNetwork.DenseNet_121/0, where GetParam() = HALIDE/CPU
/opencv/modules/dnn/test/test_common.impl.hpp:74: Failure
Expected: (normL1) <= (l1), actual: 2.13725e+14 vs 1e-05
First run  |ref| = 4.5998954772949219
/opencv/modules/dnn/test/test_common.impl.hpp:77: Failure
Expected: (normInf) <= (lInf), actual: 1.0172e+15 vs 0.0001
First run  |ref| = 4.5998954772949219
/opencv/modules/dnn/test/test_common.impl.hpp:74: Failure
Expected: (normL1) <= (l1), actual: 6.30883e+27 vs 1e-05
Second run  |ref| = 4.6870512962341309
/opencv/modules/dnn/test/test_common.impl.hpp:77: Failure
Expected: (normInf) <= (lInf), actual: 2.82611e+28 vs 0.0001
Second run  |ref| = 4.6870512962341309
[  FAILED  ] DNNTestNetwork.DenseNet_121/0, where GetParam() = HALIDE/CPU (7884 ms)
[ RUN      ] DNNTestNetwork.FastNeuralStyle_eccv16/0, where GetParam() = HALIDE/CPU
/opencv/modules/dnn/test/test_common.impl.hpp:74: Failure
Expected: (normL1) <= (l1), actual: 12.1963 vs 0.0001
First run  |ref| = 148.53861999511719
/opencv/modules/dnn/test/test_common.impl.hpp:77: Failure
Expected: (normInf) <= (lInf), actual: 208.974 vs 0.002
First run  |ref| = 148.53861999511719
/opencv/modules/dnn/test/test_common.impl.hpp:74: Failure
Expected: (normL1) <= (l1), actual: 12.1362 vs 0.0001
Second run  |ref| = 148.02413940429688
/opencv/modules/dnn/test/test_common.impl.hpp:77: Failure
Expected: (normInf) <= (lInf), actual: 223.035 vs 0.002
Second run  |ref| = 148.02413940429688
[  FAILED  ] DNNTestNetwork.FastNeuralStyle_eccv16/0, where GetParam() = HALIDE/CPU (3282 ms)
[----------] 20 tests from DNNTestNetwork (59778 ms total)

[----------] Global test environment tear-down
[ SKIPSTAT ] 3 tests skipped
[ SKIPSTAT ] TAG='skip_other' skip 3 tests
[==========] 20 tests from 1 test case ran. (59778 ms total)
[  PASSED  ] 14 tests.
[  FAILED  ] 6 tests, listed below:
[  FAILED  ] DNNTestNetwork.MobileNet_SSD_v1_TensorFlow/0, where GetParam() = HALIDE/CPU
[  FAILED  ] DNNTestNetwork.MobileNet_SSD_v1_TensorFlow_Different_Width_Height/0, where GetParam() = HALIDE/CPU
[  FAILED  ] DNNTestNetwork.MobileNet_SSD_v2_TensorFlow/0, where GetParam() = HALIDE/CPU
[  FAILED  ] DNNTestNetwork.Inception_v2_SSD_TensorFlow/0, where GetParam() = HALIDE/CPU
[  FAILED  ] DNNTestNetwork.DenseNet_121/0, where GetParam() = HALIDE/CPU
[  FAILED  ] DNNTestNetwork.FastNeuralStyle_eccv16/0, where GetParam() = HALIDE/CPU

@dkurt
Copy link
Copy Markdown
Member Author

dkurt commented Oct 20, 2022

@asmorkalov, thanks! Do you know which version of Halide is used there?

@asmorkalov
Copy link
Copy Markdown
Contributor

It's default Halide package from Ubuntu 22.04 with version 13-0. Docker: opencv-infrastructure/opencv-gha-dockerfile#15
How to run container: docker run --privileged --rm -it -v /home/alexander/Projects/OpenCV/opencv-master:/opencv -v /home/alexander/Projects/OpenCV/opencv_extra/:/opencv_extra halide.

@asmorkalov
Copy link
Copy Markdown
Contributor

CPU: Core i5-2500K, no AVX2, GPU: GF 1080, if it's important.

@dkurt dkurt marked this pull request as draft October 21, 2022 12:27
@dkurt dkurt marked this pull request as ready for review October 21, 2022 12:55
@dkurt
Copy link
Copy Markdown
Member Author

dkurt commented Oct 21, 2022

Sorry, the command line is incorrect. You may run the tests by

./bin/opencv_test_dnn --gtest_param_filter=*HALIDE/CPU* --gtest_filter=DNNTestNetwork*

@asmorkalov asmorkalov merged commit 35b2cff into opencv:4.x Oct 21, 2022
@dkurt dkurt deleted the halide_fixes branch October 21, 2022 14:53
@alalek alalek mentioned this pull request Jan 8, 2023
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
* Fixes for Halide
* Enable some Halide tests
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.

3 participants