Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
自由之枫~
opencv
提交
70b0274c
O
opencv
项目概览
自由之枫~
/
opencv
与 Fork 源项目一致
Fork自
OpenCV / opencv
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
70b0274c
编写于
1月 26, 2022
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dnn: apply hint to ignore denormals processing
上级
b1d484f8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
32 addition
and
11 deletion
+32
-11
modules/dnn/src/caffe/caffe_importer.cpp
modules/dnn/src/caffe/caffe_importer.cpp
+4
-0
modules/dnn/src/darknet/darknet_importer.cpp
modules/dnn/src/darknet/darknet_importer.cpp
+3
-0
modules/dnn/src/dnn.cpp
modules/dnn/src/dnn.cpp
+13
-0
modules/dnn/src/layers/convolution_layer.cpp
modules/dnn/src/layers/convolution_layer.cpp
+0
-11
modules/dnn/src/onnx/onnx_importer.cpp
modules/dnn/src/onnx/onnx_importer.cpp
+4
-0
modules/dnn/src/tensorflow/tf_importer.cpp
modules/dnn/src/tensorflow/tf_importer.cpp
+3
-0
modules/dnn/src/torch/torch_importer.cpp
modules/dnn/src/torch/torch_importer.cpp
+5
-0
未找到文件。
modules/dnn/src/caffe/caffe_importer.cpp
浏览文件 @
70b0274c
...
...
@@ -53,6 +53,8 @@
#include "caffe_io.hpp"
#endif
#include <opencv2/core/utils/fp_control_utils.hpp>
namespace
cv
{
namespace
dnn
{
CV__DNN_EXPERIMENTAL_NS_BEGIN
...
...
@@ -88,6 +90,8 @@ MatShape parseBlobShape(const caffe::BlobShape& _input_shape)
class
CaffeImporter
{
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
caffe
::
NetParameter
net
;
caffe
::
NetParameter
netBinary
;
...
...
modules/dnn/src/darknet/darknet_importer.cpp
浏览文件 @
70b0274c
...
...
@@ -51,6 +51,7 @@
#include "darknet_io.hpp"
#include <opencv2/core/utils/fp_control_utils.hpp>
namespace
cv
{
namespace
dnn
{
...
...
@@ -61,6 +62,8 @@ namespace
class
DarknetImporter
{
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
darknet
::
NetParameter
net
;
public:
...
...
modules/dnn/src/dnn.cpp
浏览文件 @
70b0274c
...
...
@@ -55,6 +55,8 @@
#include <opencv2/dnn/shape_utils.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/core/utils/fp_control_utils.hpp>
#include <opencv2/core/utils/configuration.private.hpp>
#include <opencv2/core/utils/logger.hpp>
...
...
@@ -3504,6 +3506,9 @@ Net Net::readFromModelOptimizer(const String& xml, const String& bin)
CV_UNUSED
(
xml
);
CV_UNUSED
(
bin
);
CV_Error
(
Error
::
StsError
,
"Build OpenCV with Inference Engine to enable loading models from Model Optimizer."
);
#else
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
#if INF_ENGINE_VER_MAJOR_LE(INF_ENGINE_RELEASE_2019R3)
InferenceEngine
::
CNNNetReader
reader
;
reader
.
ReadNetwork
(
xml
);
...
...
@@ -3540,6 +3545,8 @@ Net Net::readFromModelOptimizer(
CV_Error
(
Error
::
StsError
,
"Build OpenCV with Inference Engine to enable loading models from Model Optimizer."
);
#else
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
#if INF_ENGINE_VER_MAJOR_LE(INF_ENGINE_RELEASE_2019R3)
InferenceEngine
::
CNNNetReader
reader
;
...
...
@@ -3639,6 +3646,7 @@ Mat Net::forward(const String& outputName)
{
CV_TRACE_FUNCTION
();
CV_Assert
(
!
empty
());
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
String
layerName
=
outputName
;
...
...
@@ -3660,6 +3668,7 @@ AsyncArray Net::forwardAsync(const String& outputName)
{
CV_TRACE_FUNCTION
();
CV_Assert
(
!
empty
());
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
#ifdef CV_CXX11
String
layerName
=
outputName
;
...
...
@@ -3691,6 +3700,7 @@ void Net::forward(OutputArrayOfArrays outputBlobs, const String& outputName)
{
CV_TRACE_FUNCTION
();
CV_Assert
(
!
empty
());
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
String
layerName
=
outputName
;
...
...
@@ -3769,6 +3779,7 @@ void Net::forward(OutputArrayOfArrays outputBlobs,
const
std
::
vector
<
String
>&
outBlobNames
)
{
CV_TRACE_FUNCTION
();
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
std
::
vector
<
LayerPin
>
pins
;
for
(
int
i
=
0
;
i
<
outBlobNames
.
size
();
i
++
)
...
...
@@ -3796,6 +3807,7 @@ void Net::forward(std::vector<std::vector<Mat> >& outputBlobs,
const
std
::
vector
<
String
>&
outBlobNames
)
{
CV_TRACE_FUNCTION
();
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
std
::
vector
<
LayerPin
>
pins
;
for
(
int
i
=
0
;
i
<
outBlobNames
.
size
();
i
++
)
...
...
@@ -3886,6 +3898,7 @@ void Net::setInput(InputArray blob, const String& name, double scalefactor, cons
{
CV_TRACE_FUNCTION
();
CV_TRACE_ARG_VALUE
(
name
,
"name"
,
name
.
c_str
());
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
LayerPin
pin
;
pin
.
lid
=
0
;
...
...
modules/dnn/src/layers/convolution_layer.cpp
浏览文件 @
70b0274c
...
...
@@ -1629,13 +1629,6 @@ public:
CV_TRACE_FUNCTION
();
CV_TRACE_ARG_VALUE
(
name
,
"name"
,
name
.
c_str
());
#if CV_SSE3
uint32_t
ftzMode
=
_MM_GET_FLUSH_ZERO_MODE
();
uint32_t
dazMode
=
_MM_GET_DENORMALS_ZERO_MODE
();
_MM_SET_FLUSH_ZERO_MODE
(
_MM_FLUSH_ZERO_ON
);
_MM_SET_DENORMALS_ZERO_MODE
(
_MM_DENORMALS_ZERO_ON
);
#endif
CV_OCL_RUN
(
IS_DNN_OPENCL_TARGET
(
preferableTarget
),
forward_ocl
(
inputs_arr
,
outputs_arr
,
internals_arr
))
...
...
@@ -1748,10 +1741,6 @@ public:
ParallelConv
::
run
(
inputs
[
0
],
outputs
[
0
],
weightsMat
,
biasvec
,
reluslope
,
kernel_size
,
strides
,
pads_begin
,
pads_end
,
dilations
,
activ
.
get
(),
ngroups
,
nstripes
);
}
#if CV_SSE3
_MM_SET_FLUSH_ZERO_MODE
(
ftzMode
);
_MM_SET_DENORMALS_ZERO_MODE
(
dazMode
);
#endif
}
virtual
int64
getFLOPS
(
const
std
::
vector
<
MatShape
>
&
inputs
,
...
...
modules/dnn/src/onnx/onnx_importer.cpp
浏览文件 @
70b0274c
...
...
@@ -8,6 +8,8 @@
#include "../precomp.hpp"
#include <opencv2/dnn/shape_utils.hpp>
#include <opencv2/core/utils/fp_control_utils.hpp>
#include <opencv2/core/utils/logger.defines.hpp>
#undef CV_LOG_STRIP_LEVEL
#define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_VERBOSE + 1
...
...
@@ -40,6 +42,8 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
class
ONNXImporter
{
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
opencv_onnx
::
ModelProto
model_proto
;
struct
LayerInfo
{
int
layerId
;
...
...
modules/dnn/src/tensorflow/tf_importer.cpp
浏览文件 @
70b0274c
...
...
@@ -11,6 +11,8 @@ Implementation of Tensorflow models parser
#include "../precomp.hpp"
#include <opencv2/core/utils/fp_control_utils.hpp>
#include <opencv2/core/utils/logger.defines.hpp>
#include <opencv2/dnn/shape_utils.hpp>
#undef CV_LOG_STRIP_LEVEL
...
...
@@ -509,6 +511,7 @@ void ExcludeLayer(tensorflow::GraphDef& net, const int layer_index, const int in
class
TFImporter
{
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
public:
TFImporter
(
Net
&
net
,
const
char
*
model
,
const
char
*
config
=
NULL
);
TFImporter
(
Net
&
net
,
const
char
*
dataModel
,
size_t
lenModel
,
...
...
modules/dnn/src/torch/torch_importer.cpp
浏览文件 @
70b0274c
...
...
@@ -40,6 +40,9 @@
//M*/
#include "../precomp.hpp"
#include <opencv2/core/utils/fp_control_utils.hpp>
#include <limits>
#include <set>
#include <map>
...
...
@@ -106,6 +109,8 @@ static inline bool endsWith(const String &str, const char *substr)
struct
TorchImporter
{
FPDenormalsIgnoreHintScope
fp_denormals_ignore_scope
;
typedef
std
::
map
<
String
,
std
::
pair
<
int
,
Mat
>
>
TensorsMap
;
Net
net
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录