Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
99c4b76a
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
99c4b76a
编写于
7月 03, 2020
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dnn(test): add YOLOv4-tiny tests
上级
65dbbf71
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
85 addition
and
2 deletion
+85
-2
modules/dnn/perf/perf_net.cpp
modules/dnn/perf/perf_net.cpp
+13
-0
modules/dnn/test/test_common.impl.hpp
modules/dnn/test/test_common.impl.hpp
+7
-1
modules/dnn/test/test_darknet_importer.cpp
modules/dnn/test/test_darknet_importer.cpp
+65
-1
未找到文件。
modules/dnn/perf/perf_net.cpp
浏览文件 @
99c4b76a
...
...
@@ -216,6 +216,19 @@ PERF_TEST_P_(DNNTestNetwork, YOLOv4)
processNet
(
"dnn/yolov4.weights"
,
"dnn/yolov4.cfg"
,
""
,
inp
);
}
PERF_TEST_P_
(
DNNTestNetwork
,
YOLOv4_tiny
)
{
if
(
backend
==
DNN_BACKEND_HALIDE
)
throw
SkipTestException
(
""
);
if
(
target
==
DNN_TARGET_MYRIAD
)
throw
SkipTestException
(
""
);
Mat
sample
=
imread
(
findDataFile
(
"dnn/dog416.png"
));
cvtColor
(
sample
,
sample
,
COLOR_BGR2RGB
);
Mat
inp
;
sample
.
convertTo
(
inp
,
CV_32FC3
,
1.0
f
/
255
,
0
);
processNet
(
"dnn/yolov4-tiny.weights"
,
"dnn/yolov4-tiny.cfg"
,
""
,
inp
);
}
PERF_TEST_P_
(
DNNTestNetwork
,
EAST_text_detection
)
{
if
(
backend
==
DNN_BACKEND_HALIDE
)
...
...
modules/dnn/test/test_common.impl.hpp
浏览文件 @
99c4b76a
...
...
@@ -96,9 +96,12 @@ void normAssertDetections(
const
char
*
comment
/*= ""*/
,
double
confThreshold
/*= 0.0*/
,
double
scores_diff
/*= 1e-5*/
,
double
boxes_iou_diff
/*= 1e-4*/
)
{
ASSERT_FALSE
(
testClassIds
.
empty
())
<<
"No detections"
;
std
::
vector
<
bool
>
matchedRefBoxes
(
refBoxes
.
size
(),
false
);
std
::
vector
<
double
>
refBoxesIoUDiff
(
refBoxes
.
size
(),
1.0
);
for
(
int
i
=
0
;
i
<
testBoxes
.
size
();
++
i
)
{
//cout << "Test[i=" << i << "]: score=" << testScores[i] << " id=" << testClassIds[i] << " box " << testBoxes[i] << endl;
double
testScore
=
testScores
[
i
];
if
(
testScore
<
confThreshold
)
continue
;
...
...
@@ -115,6 +118,7 @@ void normAssertDetections(
double
interArea
=
(
testBox
&
refBoxes
[
j
]).
area
();
double
iou
=
interArea
/
(
testBox
.
area
()
+
refBoxes
[
j
].
area
()
-
interArea
);
topIoU
=
std
::
max
(
topIoU
,
iou
);
refBoxesIoUDiff
[
j
]
=
std
::
min
(
refBoxesIoUDiff
[
j
],
1.0
f
-
iou
);
if
(
1.0
-
iou
<
boxes_iou_diff
)
{
matched
=
true
;
...
...
@@ -137,7 +141,9 @@ void normAssertDetections(
if
(
!
matchedRefBoxes
[
i
]
&&
refScores
[
i
]
>
confThreshold
)
{
std
::
cout
<<
cv
::
format
(
"Unmatched reference: class %d score %f box "
,
refClassIds
[
i
],
refScores
[
i
])
<<
refBoxes
[
i
]
<<
std
::
endl
;
refClassIds
[
i
],
refScores
[
i
])
<<
refBoxes
[
i
]
<<
" IoU diff: "
<<
refBoxesIoUDiff
[
i
]
<<
std
::
endl
;
EXPECT_LE
(
refScores
[
i
],
confThreshold
)
<<
comment
;
}
}
...
...
modules/dnn/test/test_darknet_importer.cpp
浏览文件 @
99c4b76a
...
...
@@ -254,6 +254,13 @@ public:
}
if
(
cvIsNaN
(
iouDiff
))
{
if
(
b
==
0
)
std
::
cout
<<
"Skip accuracy checks"
<<
std
::
endl
;
continue
;
}
normAssertDetections
(
refClassIds
[
b
],
refConfidences
[
b
],
refBoxes
[
b
],
nms_classIds
,
nms_confidences
,
nms_boxes
,
format
(
"batch size %d, sample %d
\n
"
,
batch_size
,
b
).
c_str
(),
confThreshold
,
scoreDiff
,
iouDiff
);
}
...
...
@@ -449,7 +456,7 @@ TEST_P(Test_Darknet_nets_async, Accuracy)
}
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_Darknet_nets_async
,
Combine
(
Values
(
"yolo-voc"
,
"tiny-yolo-voc"
,
"yolov3"
,
"yolov4"
),
Values
(
"yolo-voc"
,
"tiny-yolo-voc"
,
"yolov3"
,
"yolov4"
,
"yolov4-tiny"
),
dnnBackendsAndTargets
()
));
...
...
@@ -587,6 +594,63 @@ TEST_P(Test_Darknet_nets, YOLOv4)
}
}
TEST_P
(
Test_Darknet_nets
,
YOLOv4_tiny
)
{
applyTestTag
(
target
==
DNN_TARGET_CPU
?
CV_TEST_TAG_MEMORY_512MB
:
CV_TEST_TAG_MEMORY_1GB
);
const
double
confThreshold
=
0.5
;
// batchId, classId, confidence, left, top, right, bottom
const
int
N0
=
2
;
const
int
N1
=
3
;
static
const
float
ref_
[
/* (N0 + N1) * 7 */
]
=
{
0
,
7
,
0.85935
f
,
0.593484
f
,
0.141211
f
,
0.920356
f
,
0.291593
f
,
0
,
16
,
0.795188
f
,
0.169207
f
,
0.386886
f
,
0.423753
f
,
0.933004
f
,
1
,
2
,
0.996832
f
,
0.653802
f
,
0.464573
f
,
0.815193
f
,
0.653292
f
,
1
,
2
,
0.963325
f
,
0.451151
f
,
0.458915
f
,
0.496255
f
,
0.52241
f
,
1
,
0
,
0.926244
f
,
0.194851
f
,
0.361743
f
,
0.260277
f
,
0.632364
f
,
};
Mat
ref
(
N0
+
N1
,
7
,
CV_32FC1
,
(
void
*
)
ref_
);
double
scoreDiff
=
0.01
f
;
double
iouDiff
=
(
target
==
DNN_TARGET_OPENCL_FP16
||
target
==
DNN_TARGET_MYRIAD
)
?
0.15
:
0.01
f
;
std
::
string
config_file
=
"yolov4-tiny.cfg"
;
std
::
string
weights_file
=
"yolov4-tiny.weights"
;
#if defined(INF_ENGINE_RELEASE)
if
(
target
==
DNN_TARGET_MYRIAD
)
// bad accuracy
iouDiff
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_OPENCL
)
iouDiff
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
if
((
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
DNN_TARGET_OPENCL_FP16
)
iouDiff
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
#endif
{
SCOPED_TRACE
(
"batch size 1"
);
testDarknetModel
(
config_file
,
weights_file
,
ref
.
rowRange
(
0
,
N0
),
scoreDiff
,
iouDiff
,
confThreshold
);
}
{
SCOPED_TRACE
(
"batch size 2"
);
testDarknetModel
(
config_file
,
weights_file
,
ref
,
scoreDiff
,
iouDiff
,
confThreshold
);
}
#if defined(INF_ENGINE_RELEASE)
if
(
target
==
DNN_TARGET_MYRIAD
)
// bad accuracy
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_MYRIAD
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
if
(
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
&&
target
==
DNN_TARGET_OPENCL
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
if
((
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
||
backend
==
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
&&
DNN_TARGET_OPENCL_FP16
)
applyTestTag
(
CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16
,
CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
#endif
}
INSTANTIATE_TEST_CASE_P
(
/**/
,
Test_Darknet_nets
,
dnnBackendsAndTargets
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录