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
050916fd
Commit
050916fd
authored
Oct 10, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnn: modify priorBox layer
parent
af8ed9d0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
0 deletions
+83
-0
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
+47
-0
No files found.
modules/dnn/misc/caffe/caffe.pb.cc
View file @
050916fd
This diff is collapsed.
Click to expand it.
modules/dnn/misc/caffe/caffe.pb.h
View file @
050916fd
...
@@ -1537,6 +1537,13 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
...
@@ -1537,6 +1537,13 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
float
offset
()
const
;
float
offset
()
const
;
void
set_offset
(
float
value
);
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)
// @@protoc_insertion_point(class_scope:caffe.PriorBoxParameter)
private
:
private
:
inline
void
set_has_min_size
();
inline
void
set_has_min_size
();
...
@@ -1561,6 +1568,8 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
...
@@ -1561,6 +1568,8 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
inline
void
clear_has_step_w
();
inline
void
clear_has_step_w
();
inline
void
set_has_offset
();
inline
void
set_has_offset
();
inline
void
clear_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
::
InternalMetadataWithArena
_internal_metadata_
;
::
google
::
protobuf
::
internal
::
HasBits
<
1
>
_has_bits_
;
::
google
::
protobuf
::
internal
::
HasBits
<
1
>
_has_bits_
;
...
@@ -1575,6 +1584,7 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
...
@@ -1575,6 +1584,7 @@ class PriorBoxParameter : public ::google::protobuf::Message /* @@protoc_inserti
float
step_
;
float
step_
;
float
step_h_
;
float
step_h_
;
float
step_w_
;
float
step_w_
;
bool
additional_y_offset_
;
bool
flip_
;
bool
flip_
;
bool
clip_
;
bool
clip_
;
float
offset_
;
float
offset_
;
...
@@ -13635,6 +13645,30 @@ inline void PriorBoxParameter::set_offset(float value) {
...
@@ -13635,6 +13645,30 @@ inline void PriorBoxParameter::set_offset(float value) {
// @@protoc_insertion_point(field_set:caffe.PriorBoxParameter.offset)
// @@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
()
{
inline
const
PriorBoxParameter
*
PriorBoxParameter
::
internal_default_instance
()
{
return
&
PriorBoxParameter_default_instance_
.
get
();
return
&
PriorBoxParameter_default_instance_
.
get
();
}
}
modules/dnn/src/caffe/caffe.proto
View file @
050916fd
...
@@ -145,6 +145,8 @@ message PriorBoxParameter {
...
@@ -145,6 +145,8 @@ message PriorBoxParameter {
optional
float
step_w
=
12
;
optional
float
step_w
=
12
;
// Offset to the top left corner of each cell.
// Offset to the top left corner of each cell.
optional
float
offset
=
13
[
default
=
0.5
];
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
// Message that store parameters used by DetectionOutputLayer
...
...
modules/dnn/src/layers/prior_box_layer.cpp
View file @
050916fd
...
@@ -216,6 +216,14 @@ public:
...
@@ -216,6 +216,14 @@ public:
_stepY
=
0
;
_stepY
=
0
;
_stepX
=
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
,
bool
getMemoryShapes
(
const
std
::
vector
<
MatShape
>
&
inputs
,
...
@@ -289,6 +297,19 @@ public:
...
@@ -289,6 +297,19 @@ public:
// ymax
// ymax
outputPtr
[
idx
++
]
=
(
center_y
+
_boxHeight
/
2.
)
/
_imageHeight
;
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
)
if
(
_maxSize
>
0
)
{
{
// second prior: aspect_ratio = 1, size = sqrt(min_size * max_size)
// second prior: aspect_ratio = 1, size = sqrt(min_size * max_size)
...
@@ -301,6 +322,19 @@ public:
...
@@ -301,6 +322,19 @@ public:
outputPtr
[
idx
++
]
=
(
center_x
+
_boxWidth
/
2.
)
/
_imageWidth
;
outputPtr
[
idx
++
]
=
(
center_x
+
_boxWidth
/
2.
)
/
_imageWidth
;
// ymax
// ymax
outputPtr
[
idx
++
]
=
(
center_y
+
_boxHeight
/
2.
)
/
_imageHeight
;
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
// rest of priors
...
@@ -319,6 +353,18 @@ public:
...
@@ -319,6 +353,18 @@ public:
outputPtr
[
idx
++
]
=
(
center_x
+
_boxWidth
/
2.
)
/
_imageWidth
;
outputPtr
[
idx
++
]
=
(
center_x
+
_boxWidth
/
2.
)
/
_imageWidth
;
// ymax
// ymax
outputPtr
[
idx
++
]
=
(
center_y
+
_boxHeight
/
2.
)
/
_imageHeight
;
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 +431,7 @@ public:
...
@@ -385,6 +431,7 @@ public:
bool
_flip
;
bool
_flip
;
bool
_clip
;
bool
_clip
;
bool
_additional_y_offset
;
size_t
_numPriors
;
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