mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #17297 from dkurt:dnn_yolov3_ocl
This commit is contained in:
commit
322960f795
@ -106,6 +106,7 @@ void normAssertDetections(
|
|||||||
int testClassId = testClassIds[i];
|
int testClassId = testClassIds[i];
|
||||||
const cv::Rect2d& testBox = testBoxes[i];
|
const cv::Rect2d& testBox = testBoxes[i];
|
||||||
bool matched = false;
|
bool matched = false;
|
||||||
|
double topIoU = 0;
|
||||||
for (int j = 0; j < refBoxes.size() && !matched; ++j)
|
for (int j = 0; j < refBoxes.size() && !matched; ++j)
|
||||||
{
|
{
|
||||||
if (!matchedRefBoxes[j] && testClassId == refClassIds[j] &&
|
if (!matchedRefBoxes[j] && testClassId == refClassIds[j] &&
|
||||||
@ -113,7 +114,8 @@ void normAssertDetections(
|
|||||||
{
|
{
|
||||||
double interArea = (testBox & refBoxes[j]).area();
|
double interArea = (testBox & refBoxes[j]).area();
|
||||||
double iou = interArea / (testBox.area() + refBoxes[j].area() - interArea);
|
double iou = interArea / (testBox.area() + refBoxes[j].area() - interArea);
|
||||||
if (std::abs(iou - 1.0) < boxes_iou_diff)
|
topIoU = std::max(topIoU, iou);
|
||||||
|
if (1.0 - iou < boxes_iou_diff)
|
||||||
{
|
{
|
||||||
matched = true;
|
matched = true;
|
||||||
matchedRefBoxes[j] = true;
|
matchedRefBoxes[j] = true;
|
||||||
@ -121,8 +123,11 @@ void normAssertDetections(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!matched)
|
if (!matched)
|
||||||
|
{
|
||||||
std::cout << cv::format("Unmatched prediction: class %d score %f box ",
|
std::cout << cv::format("Unmatched prediction: class %d score %f box ",
|
||||||
testClassId, testScore) << testBox << std::endl;
|
testClassId, testScore) << testBox << std::endl;
|
||||||
|
std::cout << "Highest IoU: " << topIoU << std::endl;
|
||||||
|
}
|
||||||
EXPECT_TRUE(matched) << comment;
|
EXPECT_TRUE(matched) << comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ TEST_P(Test_Darknet_nets, YOLOv3)
|
|||||||
1, 2, 0.997412f, 0.647584f, 0.459939f, 0.821038f, 0.663947f); // a car
|
1, 2, 0.997412f, 0.647584f, 0.459939f, 0.821038f, 0.663947f); // a car
|
||||||
|
|
||||||
double scoreDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.006 : 8e-5;
|
double scoreDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.006 : 8e-5;
|
||||||
double iouDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.018 : 3e-4;
|
double iouDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.042 : 3e-4;
|
||||||
|
|
||||||
std::string config_file = "yolov3.cfg";
|
std::string config_file = "yolov3.cfg";
|
||||||
std::string weights_file = "yolov3.weights";
|
std::string weights_file = "yolov3.weights";
|
||||||
@ -487,15 +487,10 @@ TEST_P(Test_Darknet_nets, YOLOv3)
|
|||||||
#if defined(INF_ENGINE_RELEASE)
|
#if defined(INF_ENGINE_RELEASE)
|
||||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
|
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
|
||||||
{
|
{
|
||||||
if (INF_ENGINE_VER_MAJOR_LE(2018050000) && target == DNN_TARGET_OPENCL)
|
if (target == DNN_TARGET_OPENCL)
|
||||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
|
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
|
||||||
else if (INF_ENGINE_VER_MAJOR_EQ(2019020000))
|
else if (target == DNN_TARGET_OPENCL_FP16 && INF_ENGINE_VER_MAJOR_LE(202010000))
|
||||||
{
|
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
|
||||||
if (target == DNN_TARGET_OPENCL)
|
|
||||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
|
|
||||||
if (target == DNN_TARGET_OPENCL_FP16)
|
|
||||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
|
|
||||||
}
|
|
||||||
else if (target == DNN_TARGET_MYRIAD &&
|
else if (target == DNN_TARGET_MYRIAD &&
|
||||||
getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X)
|
getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X)
|
||||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X);
|
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X);
|
||||||
|
Loading…
Reference in New Issue
Block a user