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
60e5e213
Commit
60e5e213
authored
May 05, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11454 from seiko2plus:issue11433_samples
parents
527696dd
e00a58a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
custom_layers.cpp
samples/cpp/tutorial_code/dnn/custom_layers.cpp
+10
-10
No files found.
samples/cpp/tutorial_code/dnn/custom_layers.cpp
View file @
60e5e213
...
@@ -16,18 +16,18 @@ public:
...
@@ -16,18 +16,18 @@ public:
virtual
bool
getMemoryShapes
(
const
std
::
vector
<
std
::
vector
<
int
>
>
&
inputs
,
virtual
bool
getMemoryShapes
(
const
std
::
vector
<
std
::
vector
<
int
>
>
&
inputs
,
const
int
requiredOutputs
,
const
int
requiredOutputs
,
std
::
vector
<
std
::
vector
<
int
>
>
&
outputs
,
std
::
vector
<
std
::
vector
<
int
>
>
&
outputs
,
std
::
vector
<
std
::
vector
<
int
>
>
&
internals
)
const
;
std
::
vector
<
std
::
vector
<
int
>
>
&
internals
)
const
CV_OVERRIDE
;
//! [MyLayer::getMemoryShapes]
//! [MyLayer::getMemoryShapes]
//! [MyLayer::forward]
//! [MyLayer::forward]
virtual
void
forward
(
std
::
vector
<
cv
::
Mat
*>
&
inputs
,
std
::
vector
<
cv
::
Mat
>
&
outputs
,
std
::
vector
<
cv
::
Mat
>
&
internals
);
virtual
void
forward
(
std
::
vector
<
cv
::
Mat
*>
&
inputs
,
std
::
vector
<
cv
::
Mat
>
&
outputs
,
std
::
vector
<
cv
::
Mat
>
&
internals
)
CV_OVERRIDE
;
//! [MyLayer::forward]
//! [MyLayer::forward]
//! [MyLayer::finalize]
//! [MyLayer::finalize]
virtual
void
finalize
(
const
std
::
vector
<
cv
::
Mat
*>
&
inputs
,
std
::
vector
<
cv
::
Mat
>
&
outputs
);
virtual
void
finalize
(
const
std
::
vector
<
cv
::
Mat
*>
&
inputs
,
std
::
vector
<
cv
::
Mat
>
&
outputs
)
CV_OVERRIDE
;
//! [MyLayer::finalize]
//! [MyLayer::finalize]
virtual
void
forward
(
cv
::
InputArrayOfArrays
inputs
,
cv
::
OutputArrayOfArrays
outputs
,
cv
::
OutputArrayOfArrays
internals
);
virtual
void
forward
(
cv
::
InputArrayOfArrays
inputs
,
cv
::
OutputArrayOfArrays
outputs
,
cv
::
OutputArrayOfArrays
internals
)
CV_OVERRIDE
;
};
};
//! [A custom layer interface]
//! [A custom layer interface]
...
@@ -49,7 +49,7 @@ public:
...
@@ -49,7 +49,7 @@ public:
virtual
bool
getMemoryShapes
(
const
std
::
vector
<
std
::
vector
<
int
>
>
&
inputs
,
virtual
bool
getMemoryShapes
(
const
std
::
vector
<
std
::
vector
<
int
>
>
&
inputs
,
const
int
requiredOutputs
,
const
int
requiredOutputs
,
std
::
vector
<
std
::
vector
<
int
>
>
&
outputs
,
std
::
vector
<
std
::
vector
<
int
>
>
&
outputs
,
std
::
vector
<
std
::
vector
<
int
>
>
&
internals
)
const
std
::
vector
<
std
::
vector
<
int
>
>
&
internals
)
const
CV_OVERRIDE
{
{
CV_UNUSED
(
requiredOutputs
);
CV_UNUSED
(
internals
);
CV_UNUSED
(
requiredOutputs
);
CV_UNUSED
(
internals
);
std
::
vector
<
int
>
outShape
(
4
);
std
::
vector
<
int
>
outShape
(
4
);
...
@@ -62,7 +62,7 @@ public:
...
@@ -62,7 +62,7 @@ public:
}
}
// Implementation of this custom layer is based on https://github.com/cdmh/deeplab-public/blob/master/src/caffe/layers/interp_layer.cpp
// Implementation of this custom layer is based on https://github.com/cdmh/deeplab-public/blob/master/src/caffe/layers/interp_layer.cpp
virtual
void
forward
(
std
::
vector
<
cv
::
Mat
*>
&
inputs
,
std
::
vector
<
cv
::
Mat
>
&
outputs
,
std
::
vector
<
cv
::
Mat
>
&
internals
)
virtual
void
forward
(
std
::
vector
<
cv
::
Mat
*>
&
inputs
,
std
::
vector
<
cv
::
Mat
>
&
outputs
,
std
::
vector
<
cv
::
Mat
>
&
internals
)
CV_OVERRIDE
{
{
CV_UNUSED
(
internals
);
CV_UNUSED
(
internals
);
cv
::
Mat
&
inp
=
*
inputs
[
0
];
cv
::
Mat
&
inp
=
*
inputs
[
0
];
...
@@ -105,7 +105,7 @@ public:
...
@@ -105,7 +105,7 @@ public:
}
}
}
}
virtual
void
forward
(
cv
::
InputArrayOfArrays
,
cv
::
OutputArrayOfArrays
,
cv
::
OutputArrayOfArrays
)
{}
virtual
void
forward
(
cv
::
InputArrayOfArrays
,
cv
::
OutputArrayOfArrays
,
cv
::
OutputArrayOfArrays
)
CV_OVERRIDE
{}
private
:
private
:
int
outWidth
,
outHeight
;
int
outWidth
,
outHeight
;
...
@@ -132,7 +132,7 @@ public:
...
@@ -132,7 +132,7 @@ public:
virtual
bool
getMemoryShapes
(
const
std
::
vector
<
std
::
vector
<
int
>
>
&
inputs
,
virtual
bool
getMemoryShapes
(
const
std
::
vector
<
std
::
vector
<
int
>
>
&
inputs
,
const
int
requiredOutputs
,
const
int
requiredOutputs
,
std
::
vector
<
std
::
vector
<
int
>
>
&
outputs
,
std
::
vector
<
std
::
vector
<
int
>
>
&
outputs
,
std
::
vector
<
std
::
vector
<
int
>
>
&
internals
)
const
std
::
vector
<
std
::
vector
<
int
>
>
&
internals
)
const
CV_OVERRIDE
{
{
CV_UNUSED
(
requiredOutputs
);
CV_UNUSED
(
internals
);
CV_UNUSED
(
requiredOutputs
);
CV_UNUSED
(
internals
);
std
::
vector
<
int
>
outShape
(
4
);
std
::
vector
<
int
>
outShape
(
4
);
...
@@ -146,7 +146,7 @@ public:
...
@@ -146,7 +146,7 @@ public:
// This implementation is based on a reference implementation from
// This implementation is based on a reference implementation from
// https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/kernels/internal/reference/reference_ops.h
// https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/kernels/internal/reference/reference_ops.h
virtual
void
forward
(
std
::
vector
<
cv
::
Mat
*>
&
inputs
,
std
::
vector
<
cv
::
Mat
>
&
outputs
,
std
::
vector
<
cv
::
Mat
>
&
internals
)
virtual
void
forward
(
std
::
vector
<
cv
::
Mat
*>
&
inputs
,
std
::
vector
<
cv
::
Mat
>
&
outputs
,
std
::
vector
<
cv
::
Mat
>
&
internals
)
CV_OVERRIDE
{
{
CV_UNUSED
(
internals
);
CV_UNUSED
(
internals
);
cv
::
Mat
&
inp
=
*
inputs
[
0
];
cv
::
Mat
&
inp
=
*
inputs
[
0
];
...
@@ -187,7 +187,7 @@ public:
...
@@ -187,7 +187,7 @@ public:
}
}
}
}
virtual
void
forward
(
cv
::
InputArrayOfArrays
,
cv
::
OutputArrayOfArrays
,
cv
::
OutputArrayOfArrays
)
{}
virtual
void
forward
(
cv
::
InputArrayOfArrays
,
cv
::
OutputArrayOfArrays
,
cv
::
OutputArrayOfArrays
)
CV_OVERRIDE
{}
private
:
private
:
static
inline
int
offset
(
const
cv
::
MatSize
&
size
,
int
c
,
int
x
,
int
y
,
int
b
)
static
inline
int
offset
(
const
cv
::
MatSize
&
size
,
int
c
,
int
x
,
int
y
,
int
b
)
...
...
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