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
c95407f1
Unverified
Commit
c95407f1
authored
Aug 09, 2019
by
Alexander Alekhin
Committed by
GitHub
Aug 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14883 from AsyaPronina:dev/asyadev/pattern_matching
parents
f1ea9d86
e06efd53
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
1 deletion
+108
-1
CMakeLists.txt
modules/gapi/CMakeLists.txt
+1
-0
gmodel_priv.hpp
modules/gapi/src/compiler/gmodel_priv.hpp
+8
-0
pattern_matching.cpp
modules/gapi/src/compiler/passes/pattern_matching.cpp
+0
-0
pattern_matching.hpp
modules/gapi/src/compiler/passes/pattern_matching.hpp
+98
-0
gapi_core_tests_inl.hpp
modules/gapi/test/common/gapi_core_tests_inl.hpp
+1
-1
gapi_int_pattern_matching_test.cpp
...les/gapi/test/internal/gapi_int_pattern_matching_test.cpp
+0
-0
No files found.
modules/gapi/CMakeLists.txt
View file @
c95407f1
...
...
@@ -60,6 +60,7 @@ set(gapi_srcs
src/compiler/passes/meta.cpp
src/compiler/passes/kernels.cpp
src/compiler/passes/exec.cpp
src/compiler/passes/pattern_matching.cpp
# Executor
src/executor/gexecutor.cpp
...
...
modules/gapi/src/compiler/gmodel_priv.hpp
View file @
c95407f1
...
...
@@ -46,6 +46,14 @@ template<typename T> inline ade::NodeHandle dataNodeOf(const ConstLayoutGraph& g
return
detail
::
dataNodeOf
(
g
,
cv
::
gimpl
::
proto
::
origin_of
(
GProtoArg
{
t
}));
}
inline
ade
::
NodeHandle
producerOf
(
const
cv
::
gimpl
::
GModel
::
Graph
&
gm
,
ade
::
NodeHandle
dh
)
{
GAPI_Assert
(
gm
.
metadata
(
dh
).
get
<
NodeType
>
().
t
==
NodeType
::
DATA
);
auto
ins
=
dh
->
inNodes
();
return
ins
.
empty
()
?
ade
::
NodeHandle
{
}
:
*
ins
.
begin
();
}
}}}
#endif // OPENCV_GAPI_GMODEL_PRIV_HPP
modules/gapi/src/compiler/passes/pattern_matching.cpp
0 → 100644
View file @
c95407f1
This diff is collapsed.
Click to expand it.
modules/gapi/src/compiler/passes/pattern_matching.hpp
0 → 100644
View file @
c95407f1
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2019 Intel Corporation
#ifndef OPENCV_GAPI_PATTERN_MATCHING_HPP
#define OPENCV_GAPI_PATTERN_MATCHING_HPP
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <list>
#include "compiler/gmodel.hpp"
namespace
cv
{
namespace
gimpl
{
struct
SubgraphMatch
{
using
M
=
std
::
unordered_map
<
ade
::
NodeHandle
// Pattern graph node
,
ade
::
NodeHandle
// Test graph node
,
ade
::
HandleHasher
<
ade
::
Node
>
>
;
using
S
=
std
::
unordered_set
<
ade
::
NodeHandle
,
ade
::
HandleHasher
<
ade
::
Node
>
>
;
M
inputDataNodes
;
M
startOpNodes
;
M
finishOpNodes
;
M
outputDataNodes
;
std
::
vector
<
ade
::
NodeHandle
>
inputTestDataNodes
;
std
::
vector
<
ade
::
NodeHandle
>
outputTestDataNodes
;
std
::
list
<
ade
::
NodeHandle
>
internalLayers
;
// FIXME: switch to operator bool() instead
bool
ok
()
const
{
return
!
inputDataNodes
.
empty
()
&&
!
startOpNodes
.
empty
()
&&
!
finishOpNodes
.
empty
()
&&
!
outputDataNodes
.
empty
()
&&
!
inputTestDataNodes
.
empty
()
&&
!
outputTestDataNodes
.
empty
();
}
S
nodes
()
const
{
S
allNodes
{};
allNodes
.
insert
(
inputTestDataNodes
.
begin
(),
inputTestDataNodes
.
end
());
for
(
const
auto
&
startOpMatch
:
startOpNodes
)
{
allNodes
.
insert
(
startOpMatch
.
second
);
}
for
(
const
auto
&
finishOpMatch
:
finishOpNodes
)
{
allNodes
.
insert
(
finishOpMatch
.
second
);
}
allNodes
.
insert
(
outputTestDataNodes
.
begin
(),
outputTestDataNodes
.
end
());
allNodes
.
insert
(
internalLayers
.
begin
(),
internalLayers
.
end
());
return
allNodes
;
}
S
startOps
()
{
S
sOps
;
for
(
const
auto
&
opMatch
:
startOpNodes
)
{
sOps
.
insert
(
opMatch
.
second
);
}
return
sOps
;
}
S
finishOps
()
{
S
fOps
;
for
(
const
auto
&
opMatch
:
finishOpNodes
)
{
fOps
.
insert
(
opMatch
.
second
);
}
return
fOps
;
}
std
::
vector
<
ade
::
NodeHandle
>
protoIns
()
{
return
inputTestDataNodes
;
}
std
::
vector
<
ade
::
NodeHandle
>
protoOuts
()
{
return
outputTestDataNodes
;
}
};
GAPI_EXPORTS
SubgraphMatch
findMatches
(
const
cv
::
gimpl
::
GModel
::
Graph
&
patternGraph
,
const
cv
::
gimpl
::
GModel
::
Graph
&
compGraph
);
}
//namespace gimpl
}
//namespace cv
#endif // OPENCV_GAPI_PATTERN_MATCHING_HPP
modules/gapi/test/common/gapi_core_tests_inl.hpp
View file @
c95407f1
...
...
@@ -14,7 +14,7 @@
namespace
opencv_test
{
TEST_P
(
MathOpTest
,
MatricesAccuracyTest
)
TEST_P
(
MathOpTest
,
MatricesAccuracyTest
)
{
// G-API code & corresponding OpenCV code ////////////////////////////////
cv
::
GMat
in1
,
in2
,
out
;
...
...
modules/gapi/test/internal/gapi_int_pattern_matching_test.cpp
0 → 100644
View file @
c95407f1
This diff is collapsed.
Click to expand it.
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