Skip to content

Change opencv_face_detector related tests and samples from caffe to onnx #25463

Merged
asmorkalov merged 11 commits intoopencv:5.xfrom
WanliZhong:ocvface2YuNet
May 8, 2024
Merged

Change opencv_face_detector related tests and samples from caffe to onnx #25463
asmorkalov merged 11 commits intoopencv:5.xfrom
WanliZhong:ocvface2YuNet

Conversation

@WanliZhong
Copy link
Copy Markdown
Member

@WanliZhong WanliZhong commented Apr 19, 2024

Part of #25314

This PR aims to change the tests related to opencv_face_detector from caffe framework to onnx. Tests in test_int8_layer.cpp and test_caffe_importer.cpp will be removed in #25323

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
force_builders=Linux OpenCL,Win64 OpenCL

@WanliZhong WanliZhong added test category: samples category: dnn cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code) OpenCV5 labels Apr 19, 2024
@WanliZhong WanliZhong added this to the 5.0 milestone Apr 19, 2024
@WanliZhong WanliZhong requested review from asmorkalov and dkurt April 19, 2024 14:42
@WanliZhong
Copy link
Copy Markdown
Member Author

CI Failed because lack of the model

2024-04-20T07:12:39.5390212Z ======================================================================
2024-04-20T07:12:39.5392620Z FAIL: test_face_detection (test_dnn.dnn_test)
2024-04-20T07:12:39.5395522Z ----------------------------------------------------------------------
2024-04-20T07:12:39.5397721Z Traceback (most recent call last):
2024-04-20T07:12:39.5400994Z   File "/home/ci/opencv/modules/dnn/misc/python/test/test_dnn.py", line 289, in test_face_detection
2024-04-20T07:12:39.5405106Z     model = self.find_dnn_file('dnn/onnx/models/yunet-202303.onnx')
2024-04-20T07:12:39.5408723Z   File "/home/ci/opencv/modules/dnn/misc/python/test/test_dnn.py", line 108, in find_dnn_file
2024-04-20T07:12:39.5413269Z     return self.find_file(filename, [os.environ.get('OPENCV_DNN_TEST_DATA_PATH', os.getcwd()),
2024-04-20T07:12:39.5417440Z   File "/home/ci/opencv/modules/python/test/tests_common.py", line 38, in find_file
2024-04-20T07:12:39.5420771Z     self.fail('File ' + filename + ' not found')
2024-04-20T07:12:39.5423507Z AssertionError: File dnn/onnx/models/yunet-202303.onnx not found
2024-04-20T07:12:39.5425273Z 
2024-04-20T07:12:39.5426394Z ----------------------------------------------------------------------

@WanliZhong
Copy link
Copy Markdown
Member Author

WanliZhong commented Apr 26, 2024

According to the Linux and Win64 OpenCL FP16 tests, the results are super different. But the default threshold is well for other platforms. BTW, the pow test failed on the OpenCL test.

AssertionError: 
Unmatched prediction: class 1 score 0.930325 box [-308.862396 x 4.926922 from (339.619507, 35.305611)]
Unmatched prediction: class 1 score 0.915783 box [-107.855331 x -213.738129 from (140.660110, 255.532501)]
Unmatched prediction: class 1 score 0.906349 box [-38.122566 x -87.518509 from (68.402832, 126.704086)]
Unmatched prediction: class 1 score 0.906005 box [-88.960144 x -7.952095 from (119.567444, 48.460594)]
Unmatched prediction: class 1 score 0.904940 box [-227.991058 x -189.537888 from (259.080353, 229.301697)]
Unmatched prediction: class 1 score 0.899944 box [-372.310822 x -44.273228 from (405.697357, 87.268158)]
Unmatched reference: class 1 score 0.930260 box [-308.869843 x 4.877964 from (339.624451, 35.324162)]
Unmatched reference: class 1 score 0.916015 box [-107.807007 x -213.788055 from (140.639618, 255.555450)]
Unmatched reference: class 1 score 0.906396 box [-38.099903 x -87.592232 from (68.393143, 126.740463)]
Unmatched reference: class 1 score 0.906021 box [-88.970688 x -7.996181 from (119.571388, 48.482178)]
Unmatched reference: class 1 score 0.904910 box [-228.003922 x -189.566910 from (259.092102, 229.307129)]
Unmatched reference: class 1 score 0.899698 box [-372.304382 x -44.319317 from (405.697784, 87.281578)]

Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@asmorkalov
Copy link
Copy Markdown
Contributor

OpenCL back-end is broken for now in 5.x because of int/int64 support. Hopefully will fix it soon.

@asmorkalov
Copy link
Copy Markdown
Contributor

@dkurt What do you think about the patch? May I merge it?

@asmorkalov asmorkalov self-assigned this May 8, 2024
@asmorkalov asmorkalov merged commit b637e3a into opencv:5.x May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: dnn category: samples cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code) OpenCV5 test

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants