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
0873ebb9
Commit
0873ebb9
authored
Oct 11, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9820 from sovrasov:text_detector_dnn
parents
5e82c98a
f7175f50
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
2 deletions
+86
-2
caffe.pb.cc
modules/dnn/misc/caffe/caffe.pb.cc
+0
-0
caffe.pb.h
modules/dnn/misc/caffe/caffe.pb.h
+34
-0
caffe.proto
modules/dnn/src/caffe/caffe.proto
+2
-0
prior_box_layer.cpp
modules/dnn/src/layers/prior_box_layer.cpp
+50
-2
No files found.
modules/dnn/misc/caffe/caffe.pb.cc
View file @
0873ebb9
This diff is collapsed.
Click to expand it.
modules/dnn/misc/caffe/caffe.pb.h
View file @
0873ebb9
...
...
@@ -1537,6 +1537,13 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
float
offset
()
const
;
void
set_offset
(
float
value
);
// optional bool additional_y_offset = 14 [default = false];
bool
has_additional_y_offset
()
const
;
void
clear_additional_y_offset
();
static
const
int
kAdditionalYOffsetFieldNumber
=
14
;
bool
additional_y_offset
()
const
;
void
set_additional_y_offset
(
bool
value
);
// @@protoc_insertion_point(class_scope:caffe.PriorBoxParameter)
private
:
inline
void
set_has_min_size
();
...
...
@@ -1561,6 +1568,8 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
inline
void
clear_has_step_w
();
inline
void
set_has_offset
();
inline
void
clear_has_offset
();
inline
void
set_has_additional_y_offset
();
inline
void
clear_has_additional_y_offset
();
::
google
::
protobuf
::
internal
::
InternalMetadataWithArena
_internal_metadata_
;
::
google
::
protobuf
::
internal
::
HasBits
<
1
>
_has_bits_
;
...
...
@@ -1575,6 +1584,7 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
float
step_
;
float
step_h_
;
float
step_w_
;
bool
additional_y_offset_
;
bool
flip_
;
bool
clip_
;
float
offset_
;
...
...
@@ -13635,6 +13645,30 @@ inline void PriorBoxParameter::set_offset(float value) {
// @@protoc_insertion_point(field_set:caffe.PriorBoxParameter.offset)
}
// optional bool additional_y_offset = 14 [default = false];
inline
bool
PriorBoxParameter
::
has_additional_y_offset
()
const
{
return
(
_has_bits_
[
0
]
&
0x00002000u
)
!=
0
;
}
inline
void
PriorBoxParameter
::
set_has_additional_y_offset
()
{
_has_bits_
[
0
]
|=
0x00002000u
;
}
inline
void
PriorBoxParameter
::
clear_has_additional_y_offset
()
{
_has_bits_
[
0
]
&=
~
0x00002000u
;
}
inline
void
PriorBoxParameter
::
clear_additional_y_offset
()
{
additional_y_offset_
=
false
;
clear_has_additional_y_offset
();
}
inline
bool
PriorBoxParameter
::
additional_y_offset
()
const
{
// @@protoc_insertion_point(field_get:caffe.PriorBoxParameter.additional_y_offset)
return
additional_y_offset_
;
}
inline
void
PriorBoxParameter
::
set_additional_y_offset
(
bool
value
)
{
set_has_additional_y_offset
();
additional_y_offset_
=
value
;
// @@protoc_insertion_point(field_set:caffe.PriorBoxParameter.additional_y_offset)
}
inline
const
PriorBoxParameter
*
PriorBoxParameter
::
internal_default_instance
()
{
return
&
PriorBoxParameter_default_instance_
.
get
();
}
modules/dnn/src/caffe/caffe.proto
View file @
0873ebb9
...
...
@@ -145,6 +145,8 @@ message PriorBoxParameter {
optional
float
step_w
=
12
;
// Offset to the top left corner of each cell.
optional
float
offset
=
13
[
default
=
0.5
];
// If true, two additional boxes for each center will be generated. Their centers will be shifted by y coordinate.
optional
bool
additional_y_offset
=
14
[
default
=
false
];
}
// Message that store parameters used by DetectionOutputLayer
...
...
modules/dnn/src/layers/prior_box_layer.cpp
View file @
0873ebb9
...
...
@@ -216,6 +216,14 @@ public:
_stepY
=
0
;
_stepX
=
0
;
}
if
(
params
.
has
(
"additional_y_offset"
))
{
_additional_y_offset
=
getParameter
<
bool
>
(
params
,
"additional_y_offset"
);
if
(
_additional_y_offset
)
_numPriors
*=
2
;
}
else
_additional_y_offset
=
false
;
}
bool
getMemoryShapes
(
const
std
::
vector
<
MatShape
>
&
inputs
,
...
...
@@ -246,10 +254,11 @@ public:
CV_TRACE_FUNCTION
();
CV_TRACE_ARG_VALUE
(
name
,
"name"
,
name
.
c_str
());
size_t
real_numPriors
=
_additional_y_offset
?
_numPriors
/
2
:
_numPriors
;
if
(
_scales
.
empty
())
_scales
.
resize
(
_numPriors
,
1.0
f
);
_scales
.
resize
(
real
_numPriors
,
1.0
f
);
else
CV_Assert
(
_scales
.
size
()
==
_numPriors
);
CV_Assert
(
_scales
.
size
()
==
real
_numPriors
);
int
_layerWidth
=
inputs
[
0
]
->
size
[
3
];
int
_layerHeight
=
inputs
[
0
]
->
size
[
2
];
...
...
@@ -289,6 +298,19 @@ public:
// ymax
outputPtr
[
idx
++
]
=
(
center_y
+
_boxHeight
/
2.
)
/
_imageHeight
;
if
(
_additional_y_offset
)
{
float
center_y_offset_1
=
(
h
+
1.0
)
*
stepY
;
// xmin
outputPtr
[
idx
++
]
=
(
center_x
-
_boxWidth
/
2.
)
/
_imageWidth
;
// ymin
outputPtr
[
idx
++
]
=
(
center_y_offset_1
-
_boxHeight
/
2.
)
/
_imageHeight
;
// xmax
outputPtr
[
idx
++
]
=
(
center_x
+
_boxWidth
/
2.
)
/
_imageWidth
;
// ymax
outputPtr
[
idx
++
]
=
(
center_y_offset_1
+
_boxHeight
/
2.
)
/
_imageHeight
;
}
if
(
_maxSize
>
0
)
{
// second prior: aspect_ratio = 1, size = sqrt(min_size * max_size)
...
...
@@ -301,6 +323,19 @@ public:
outputPtr
[
idx
++
]
=
(
center_x
+
_boxWidth
/
2.
)
/
_imageWidth
;
// ymax
outputPtr
[
idx
++
]
=
(
center_y
+
_boxHeight
/
2.
)
/
_imageHeight
;
if
(
_additional_y_offset
)
{
float
center_y_offset_1
=
(
h
+
1.0
)
*
stepY
;
// xmin
outputPtr
[
idx
++
]
=
(
center_x
-
_boxWidth
/
2.
)
/
_imageWidth
;
// ymin
outputPtr
[
idx
++
]
=
(
center_y_offset_1
-
_boxHeight
/
2.
)
/
_imageHeight
;
// xmax
outputPtr
[
idx
++
]
=
(
center_x
+
_boxWidth
/
2.
)
/
_imageWidth
;
// ymax
outputPtr
[
idx
++
]
=
(
center_y_offset_1
+
_boxHeight
/
2.
)
/
_imageHeight
;
}
}
// rest of priors
...
...
@@ -319,6 +354,18 @@ public:
outputPtr
[
idx
++
]
=
(
center_x
+
_boxWidth
/
2.
)
/
_imageWidth
;
// ymax
outputPtr
[
idx
++
]
=
(
center_y
+
_boxHeight
/
2.
)
/
_imageHeight
;
if
(
_additional_y_offset
)
{
float
center_y_offset_1
=
(
h
+
1.0
)
*
stepY
;
// xmin
outputPtr
[
idx
++
]
=
(
center_x
-
_boxWidth
/
2.
)
/
_imageWidth
;
// ymin
outputPtr
[
idx
++
]
=
(
center_y_offset_1
-
_boxHeight
/
2.
)
/
_imageHeight
;
// xmax
outputPtr
[
idx
++
]
=
(
center_x
+
_boxWidth
/
2.
)
/
_imageWidth
;
// ymax
outputPtr
[
idx
++
]
=
(
center_y_offset_1
+
_boxHeight
/
2.
)
/
_imageHeight
;
}
}
}
}
...
...
@@ -385,6 +432,7 @@ public:
bool
_flip
;
bool
_clip
;
bool
_additional_y_offset
;
size_t
_numPriors
;
...
...
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