Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
3ddb0054
Commit
3ddb0054
authored
Sep 13, 2019
by
Dmitry Kurtaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DetectionModel in case of out of [0, 1] range detection prediction
parent
1e410ed8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
model.cpp
modules/dnn/src/model.cpp
+1
-1
test_model.cpp
modules/dnn/test/test_model.cpp
+22
-0
No files found.
modules/dnn/src/model.cpp
View file @
3ddb0054
...
...
@@ -230,7 +230,7 @@ void DetectionModel::detect(InputArray frame, CV_OUT std::vector<int>& classIds,
int
width
=
right
-
left
+
1
;
int
height
=
bottom
-
top
+
1
;
if
(
width
*
height
<=
1
)
if
(
width
<=
2
||
height
<=
2
)
{
left
=
data
[
j
+
3
]
*
frameWidth
;
top
=
data
[
j
+
4
]
*
frameHeight
;
...
...
modules/dnn/test/test_model.cpp
View file @
3ddb0054
...
...
@@ -221,6 +221,28 @@ TEST_P(Test_Model, DetectionMobilenetSSD)
scoreDiff
,
iouDiff
,
confThreshold
,
nmsThreshold
,
size
,
mean
,
scale
);
}
TEST_P
(
Test_Model
,
Detection_normalized
)
{
std
::
string
img_path
=
_tf
(
"grace_hopper_227.png"
);
std
::
vector
<
int
>
refClassIds
=
{
15
};
std
::
vector
<
float
>
refConfidences
=
{
0.999222
f
};
std
::
vector
<
Rect2d
>
refBoxes
=
{
Rect2d
(
0
,
4
,
227
,
222
)};
std
::
string
weights_file
=
_tf
(
"MobileNetSSD_deploy.caffemodel"
);
std
::
string
config_file
=
_tf
(
"MobileNetSSD_deploy.prototxt"
);
Scalar
mean
=
Scalar
(
127.5
,
127.5
,
127.5
);
double
scale
=
1.0
/
127.5
;
Size
size
{
300
,
300
};
double
scoreDiff
=
(
target
==
DNN_TARGET_OPENCL_FP16
||
target
==
DNN_TARGET_MYRIAD
)
?
5e-3
:
1e-5
;
double
iouDiff
=
(
target
==
DNN_TARGET_OPENCL_FP16
||
target
==
DNN_TARGET_MYRIAD
)
?
0.09
:
1e-5
;
float
confThreshold
=
FLT_MIN
;
double
nmsThreshold
=
0.0
;
testDetectModel
(
weights_file
,
config_file
,
img_path
,
refClassIds
,
refConfidences
,
refBoxes
,
scoreDiff
,
iouDiff
,
confThreshold
,
nmsThreshold
,
size
,
mean
,
scale
);
}
TEST_P
(
Test_Model
,
Segmentation
)
{
std
::
string
inp
=
_tf
(
"dog416.png"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment