Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3960253

Browse files
committed
move skipModelInput
1 parent205c0d4 commit3960253

File tree

6 files changed

+93
-57
lines changed

6 files changed

+93
-57
lines changed

‎apps/model-diagnostics/model_diagnostics.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
**************************************************/
55
#include<opencv2/dnn.hpp>
66
#include<opencv2/core/utils/filesystem.hpp>
7+
#include<opencv2/dnn/utils/debug_utils.hpp>
78

89
#include<iostream>
910

@@ -57,6 +58,7 @@ int main( int argc, const char** argv )
5758
CV_Assert(!model.empty());
5859

5960
enableModelDiagnostics(true);
61+
skipModelImport(true);
6062
redirectError(diagnosticsErrorCallback,NULL);
6163

6264
Net ocvNet =readNet(model, config, frameworkId);

‎modules/dnn/include/opencv2/dnn/dnn.hpp‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ CV__DNN_INLINE_NS_BEGIN
112112
*/
113113
CV_EXPORTSvoidenableModelDiagnostics(bool isDiagnosticsMode);
114114

115-
/**
116-
* @brief Skip model import after diagnostic run in readNet() functions.
117-
* @param[in] skip Indicates whether to skip the import.
118-
*/
119-
CV_EXPORTSvoidskipModelImport(bool skip);
120-
121115
/** @brief This class provides all data needed to initialize layer.
122116
*
123117
* It includes dictionary with scalar params (which can be read by using Dict interface),
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// This file is part of OpenCV project.
2+
// It is subject to the license terms in the LICENSE file found in the top-level directory
3+
// of this distribution and at http://opencv.org/license.html.
4+
5+
#ifndef OPENCV_DNN_UTILS_DEBUG_UTILS_HPP
6+
#defineOPENCV_DNN_UTILS_DEBUG_UTILS_HPP
7+
8+
#include"../dnn.hpp"
9+
10+
namespacecv {namespacednn {
11+
CV__DNN_INLINE_NS_BEGIN
12+
13+
/**
14+
* @brief Skip model import after diagnostic run in readNet() functions.
15+
* @param[in] skip Indicates whether to skip the import.
16+
*
17+
* This is an internal OpenCV function not intended for users.
18+
*/
19+
CV_EXPORTSvoidskipModelImport(bool skip);
20+
21+
CV__DNN_INLINE_NS_END
22+
}}// namespace
23+
24+
#endif// OPENCV_DNN_UTILS_DEBUG_UTILS_HPP

‎modules/dnn/src/debug_utils.cpp‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// This file is part of OpenCV project.
2+
// It is subject to the license terms in the LICENSE file found in the top-level directory
3+
// of this distribution and at http://opencv.org/license.html.
4+
5+
#include"precomp.hpp"
6+
7+
#include<opencv2/dnn/layer_reg.private.hpp>
8+
#include<opencv2/dnn/utils/debug_utils.hpp>
9+
#include<opencv2/core/utils/logger.hpp>
10+
11+
namespacecv {namespacednn {
12+
CV__DNN_INLINE_NS_BEGIN
13+
14+
bool DNN_DIAGNOSTICS_RUN =false;
15+
bool DNN_SKIP_REAL_IMPORT =false;
16+
17+
voidenableModelDiagnostics(bool isDiagnosticsMode)
18+
{
19+
DNN_DIAGNOSTICS_RUN = isDiagnosticsMode;
20+
21+
if (DNN_DIAGNOSTICS_RUN)
22+
{
23+
detail::NotImplemented::Register();
24+
}
25+
else
26+
{
27+
detail::NotImplemented::unRegister();
28+
}
29+
}
30+
31+
voidskipModelImport(bool skip)
32+
{
33+
DNN_SKIP_REAL_IMPORT = skip;
34+
}
35+
36+
booldetail::LayerHandler::addMissing(const std::string& name,const std::string& type)
37+
{
38+
cv::AutoLocklock(getLayerFactoryMutex());
39+
auto& registeredLayers =getLayerFactoryImpl();
40+
41+
// If we didn't add it, but can create it, it's custom and not missing.
42+
if (layers.find(type) == layers.end() && registeredLayers.find(type) != registeredLayers.end())
43+
{
44+
returnfalse;
45+
}
46+
47+
if (layers.insert(type).second)
48+
{
49+
CV_LOG_ERROR(NULL,"DNN: Node='" << name <<"':\nType='"<< type <<"' is not supported.");
50+
}
51+
52+
returntrue;
53+
}
54+
55+
LayerParamsdetail::LayerHandler::getNotImplementedParams(const std::string& name,const std::string& op)
56+
{
57+
LayerParams lp;
58+
lp.name = name;
59+
lp.type ="NotImplemented";
60+
lp.set("type", op);
61+
62+
return lp;
63+
}
64+
65+
CV__DNN_INLINE_NS_END
66+
}}// namespace

‎modules/dnn/src/dnn.cpp‎

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -94,57 +94,6 @@ static bool DNN_CHECK_NAN_INF = utils::getConfigurationParameterBool("OPENCV_DNN
9494
staticbool DNN_CHECK_NAN_INF_DUMP = utils::getConfigurationParameterBool("OPENCV_DNN_CHECK_NAN_INF_DUMP",false);
9595
staticbool DNN_CHECK_NAN_INF_RAISE_ERROR = utils::getConfigurationParameterBool("OPENCV_DNN_CHECK_NAN_INF_RAISE_ERROR",false);
9696

97-
bool DNN_DIAGNOSTICS_RUN =false;
98-
bool DNN_SKIP_REAL_IMPORT =false;
99-
100-
voidenableModelDiagnostics(bool isDiagnosticsMode)
101-
{
102-
DNN_DIAGNOSTICS_RUN = isDiagnosticsMode;
103-
104-
if (DNN_DIAGNOSTICS_RUN)
105-
{
106-
detail::NotImplemented::Register();
107-
}
108-
else
109-
{
110-
detail::NotImplemented::unRegister();
111-
}
112-
}
113-
114-
voidskipModelImport(bool skip)
115-
{
116-
DNN_SKIP_REAL_IMPORT = skip;
117-
}
118-
119-
booldetail::LayerHandler::addMissing(const std::string& name,const std::string& type)
120-
{
121-
cv::AutoLocklock(getLayerFactoryMutex());
122-
auto& registeredLayers =getLayerFactoryImpl();
123-
124-
// If we didn't add it, but can create it, it's custom and not missing.
125-
if (layers.find(type) == layers.end() && registeredLayers.find(type) != registeredLayers.end())
126-
{
127-
returnfalse;
128-
}
129-
130-
if (layers.insert(type).second)
131-
{
132-
CV_LOG_ERROR(NULL,"DNN: Node='" << name <<"' of type='"<< type <<"' is not supported.");
133-
}
134-
135-
returntrue;
136-
}
137-
138-
LayerParamsdetail::LayerHandler::getNotImplementedParams(const std::string& name,const std::string& op)
139-
{
140-
LayerParams lp;
141-
lp.name = name;
142-
lp.type ="NotImplemented";
143-
lp.set("type", op);
144-
145-
return lp;
146-
}
147-
14897
using std::vector;
14998
using std::map;
15099
using std::make_pair;

‎modules/dnn/test/test_tf_importer.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Test for Tensorflow models loading
1313
#include"npy_blob.hpp"
1414

1515
#include<opencv2/dnn/layer.details.hpp>// CV_DNN_REGISTER_LAYER_CLASS
16+
#include<opencv2/dnn/utils/debug_utils.hpp>
1617

1718
namespaceopencv_test
1819
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp