opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
75.69k stars 55.61k forks source link

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

Open WanliZhong opened 1 week ago

WanliZhong commented 1 week ago

Part of https://github.com/opencv/opencv/issues/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 https://github.com/opencv/opencv/pull/25323

Pull Request Readiness Checklist

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

force_builders=Linux OpenCL,Win64 OpenCL
WanliZhong commented 1 week ago

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 commented 6 days ago

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)]
asmorkalov commented 8 hours ago

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

asmorkalov commented 8 hours ago

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