Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
05c1a3d1
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
05c1a3d1
编写于
5月 03, 2018
作者:
C
cclauss
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
print() is a function in Python 3
上级
60e5e213
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
91 addition
and
79 deletion
+91
-79
modules/core/src/opencl/runtime/generator/common.py
modules/core/src/opencl/runtime/generator/common.py
+54
-53
modules/core/src/opencl/runtime/generator/parser_cl.py
modules/core/src/opencl/runtime/generator/parser_cl.py
+3
-2
modules/core/src/opencl/runtime/generator/parser_clamdblas.py
...les/core/src/opencl/runtime/generator/parser_clamdblas.py
+3
-2
modules/core/src/opencl/runtime/generator/parser_clamdfft.py
modules/core/src/opencl/runtime/generator/parser_clamdfft.py
+3
-2
modules/dnn/misc/quantize_face_detector.py
modules/dnn/misc/quantize_face_detector.py
+3
-2
modules/java/check-tests.py
modules/java/check-tests.py
+3
-2
modules/ts/misc/perf_tests_timing.py
modules/ts/misc/perf_tests_timing.py
+3
-2
modules/ts/misc/table_formatter.py
modules/ts/misc/table_formatter.py
+2
-1
modules/ts/misc/testlog_parser.py
modules/ts/misc/testlog_parser.py
+8
-7
samples/dnn/fast_neural_style.py
samples/dnn/fast_neural_style.py
+2
-1
samples/dnn/mobilenet_ssd_accuracy.py
samples/dnn/mobilenet_ssd_accuracy.py
+3
-2
samples/python/tutorial_code/imgProc/match_template/match_template.py
...on/tutorial_code/imgProc/match_template/match_template.py
+4
-3
未找到文件。
modules/core/src/opencl/runtime/generator/common.py
浏览文件 @
05c1a3d1
from
__future__
import
print_function
import
sys
,
os
,
re
#
...
...
@@ -84,7 +85,7 @@ def readFunctionFilter(fns, fileName):
try
:
f
=
open
(
fileName
,
"r"
)
except
:
print
"ERROR: Can't open filter file: %s"
%
fileName
print
(
"ERROR: Can't open filter file: %s"
%
fileName
)
return
0
count
=
0
...
...
@@ -133,8 +134,8 @@ def outputToString(f):
@
outputToString
def
generateFilterNames
(
fns
):
for
fn
in
fns
:
print
'%s%s'
%
(
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
,
fn
[
'name'
]
)
print
'#total %d'
%
len
(
fns
)
print
(
'%s%s'
%
(
''
if
'enabled'
in
fn
else
'//'
,
fn
[
'name'
])
)
print
(
'#total %d'
%
len
(
fns
)
)
callback_check
=
re
.
compile
(
r
'([^\(]*\(.*)(\* *)(\).*\(.*\))'
)
...
...
@@ -145,100 +146,100 @@ def getTypeWithParam(t, p):
@
outputToString
def
generateStructDefinitions
(
fns
,
lprefix
=
'opencl_fn'
,
enumprefix
=
'OPENCL_FN'
):
print
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
print
(
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
)
for
fn
in
fns
:
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
commentStr
=
''
if
'enabled'
in
fn
else
'//'
decl_args
=
[]
for
(
i
,
t
)
in
enumerate
(
fn
[
'params'
]):
decl_args
.
append
(
getTypeWithParam
(
t
,
'p%d'
%
(
i
+
1
)))
decl_args_str
=
'('
+
(
', '
.
join
(
decl_args
))
+
')'
print
'%s%s%d(%s_%s, %s, %s)'
%
\
print
(
'%s%s%d(%s_%s, %s, %s)'
%
\
(
commentStr
,
lprefix
,
len
(
fn
[
'params'
]),
enumprefix
,
fn
[
'name'
],
\
' '
.
join
(
fn
[
'ret'
]),
decl_args_str
)
print
commentStr
+
(
'%s%s (%s *%s)(%s) =
\n
%s %s_%s_switch_fn;'
%
\
' '
.
join
(
fn
[
'ret'
]),
decl_args_str
)
)
print
(
commentStr
+
(
'%s%s (%s *%s)(%s) =
\n
%s %s_%s_switch_fn;'
%
\
((
' '
.
join
(
fn
[
'modifiers'
]
+
' '
)
if
len
(
fn
[
'modifiers'
])
>
0
else
''
),
' '
.
join
(
fn
[
'ret'
]),
' '
.
join
(
fn
[
'calling'
]),
fn
[
'name'
],
', '
.
join
(
fn
[
'params'
]),
\
commentStr
,
enumprefix
,
fn
[
'name'
]))
print
commentStr
+
(
'static const struct DynamicFnEntry %s_definition = { "%s", (void**)&%s};'
%
(
fn
[
'name'
],
fn
[
'name'
],
fn
[
'name'
]
))
print
commentStr
,
enumprefix
,
fn
[
'name'
]))
)
print
(
commentStr
+
(
'static const struct DynamicFnEntry %s_definition = { "%s", (void**)&%s};'
%
(
fn
[
'name'
],
fn
[
'name'
],
fn
[
'name'
])
))
print
()
@
outputToString
def
generateStaticDefinitions
(
fns
):
print
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
print
(
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
)
for
fn
in
fns
:
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
commentStr
=
''
if
'enabled'
in
fn
else
'//'
decl_args
=
[]
for
(
i
,
t
)
in
enumerate
(
fn
[
'params'
]):
decl_args
.
append
(
getTypeWithParam
(
t
,
'p%d'
%
(
i
+
1
)))
decl_args_str
=
'('
+
(
', '
.
join
(
decl_args
))
+
')'
print
commentStr
+
(
'CL_RUNTIME_EXPORT %s%s (%s *%s_pfn)(%s) = %s;'
%
\
print
(
commentStr
+
(
'CL_RUNTIME_EXPORT %s%s (%s *%s_pfn)(%s) = %s;'
%
\
((
' '
.
join
(
fn
[
'modifiers'
]
+
' '
)
if
len
(
fn
[
'modifiers'
])
>
0
else
''
),
' '
.
join
(
fn
[
'ret'
]),
' '
.
join
(
fn
[
'calling'
]),
fn
[
'name'
],
', '
.
join
(
fn
[
'params'
]),
\
fn
[
'name'
]))
fn
[
'name'
]))
)
@
outputToString
def
generateListOfDefinitions
(
fns
,
name
=
'opencl_fn_list'
):
print
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
print
'static const struct DynamicFnEntry* %s[] = {'
%
(
name
)
print
(
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
)
print
(
'static const struct DynamicFnEntry* %s[] = {'
%
(
name
)
)
for
fn
in
fns
:
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
if
fn
.
has_key
(
'enabled'
)
:
print
' &%s_definition,'
%
(
fn
[
'name'
]
)
commentStr
=
''
if
'enabled'
in
fn
else
'//'
if
'enabled'
in
fn
:
print
(
' &%s_definition,'
%
(
fn
[
'name'
])
)
else
:
print
' NULL/*&%s_definition*/,'
%
(
fn
[
'name'
]
)
print
(
' NULL/*&%s_definition*/,'
%
(
fn
[
'name'
])
)
first
=
False
print
'};'
print
(
'};'
)
@
outputToString
def
generateEnums
(
fns
,
prefix
=
'OPENCL_FN'
):
print
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
print
'enum %s_ID {'
%
prefix
print
(
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
)
print
(
'enum %s_ID {'
%
prefix
)
for
(
i
,
fn
)
in
enumerate
(
fns
):
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
print
commentStr
+
(
' %s_%s = %d,'
%
(
prefix
,
fn
[
'name'
],
i
))
print
'};'
commentStr
=
''
if
'enabled'
in
fn
else
'//'
print
(
commentStr
+
(
' %s_%s = %d,'
%
(
prefix
,
fn
[
'name'
],
i
)
))
print
(
'};'
)
@
outputToString
def
generateRemapOrigin
(
fns
):
print
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
print
(
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
)
for
fn
in
fns
:
print
'#define %s %s_'
%
(
fn
[
'name'
],
fn
[
'name'
]
)
print
(
'#define %s %s_'
%
(
fn
[
'name'
],
fn
[
'name'
])
)
@
outputToString
def
generateRemapDynamic
(
fns
):
print
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
print
(
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
)
for
fn
in
fns
:
print
'#undef %s'
%
(
fn
[
'name'
]
)
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
print
commentStr
+
(
'#define %s %s_pfn'
%
(
fn
[
'name'
],
fn
[
'name'
]
))
print
(
'#undef %s'
%
(
fn
[
'name'
])
)
commentStr
=
''
if
'enabled'
in
fn
else
'//'
print
(
commentStr
+
(
'#define %s %s_pfn'
%
(
fn
[
'name'
],
fn
[
'name'
])
))
@
outputToString
def
generateFnDeclaration
(
fns
):
print
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
print
(
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
)
for
fn
in
fns
:
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
print
commentStr
+
(
'extern CL_RUNTIME_EXPORT %s %s (%s *%s)(%s);'
%
(
' '
.
join
(
fn
[
'modifiers'
]),
' '
.
join
(
fn
[
'ret'
]),
' '
.
join
(
fn
[
'calling'
]),
fn
[
'name'
],
', '
.
join
(
fn
[
'params'
]
if
not
fn
.
has_key
(
'params_full'
)
else
fn
[
'params_full'
]
)))
commentStr
=
''
if
'enabled'
in
fn
else
'//'
print
(
commentStr
+
(
'extern CL_RUNTIME_EXPORT %s %s (%s *%s)(%s);'
%
(
' '
.
join
(
fn
[
'modifiers'
]),
' '
.
join
(
fn
[
'ret'
]),
' '
.
join
(
fn
[
'calling'
]),
fn
[
'name'
],
', '
.
join
(
fn
[
'params'
]
if
'params_full'
not
in
fn
else
fn
[
'params_full'
])
)))
@
outputToString
def
generateTemplates
(
total
,
lprefix
,
switch_name
,
calling_convention
=
''
):
print
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
print
(
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
)
for
sz
in
range
(
total
):
template_params
=
[
'ID'
,
'_R'
,
'decl_args'
]
params
=
[
'p%d'
%
(
i
+
1
)
for
i
in
range
(
0
,
sz
)]
print
'#define %s%d(%s)
\\
'
%
(
lprefix
,
sz
,
', '
.
join
(
template_params
))
print
' typedef _R (%s *ID##FN)decl_args;
\\
'
%
(
calling_convention
)
print
' static _R %s ID##_switch_fn decl_args
\\
'
%
(
calling_convention
)
print
' { return ((ID##FN)%s(ID))(%s); }
\\
'
%
(
switch_name
,
', '
.
join
(
params
))
print
''
print
(
'#define %s%d(%s)
\\
'
%
(
lprefix
,
sz
,
', '
.
join
(
template_params
)
))
print
(
' typedef _R (%s *ID##FN)decl_args;
\\
'
%
(
calling_convention
)
)
print
(
' static _R %s ID##_switch_fn decl_args
\\
'
%
(
calling_convention
)
)
print
(
' { return ((ID##FN)%s(ID))(%s); }
\\
'
%
(
switch_name
,
', '
.
join
(
params
)
))
print
(
''
)
@
outputToString
def
generateInlineWrappers
(
fns
):
print
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
]
)
print
(
'// generated by %s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
)
for
fn
in
fns
:
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
print
'#undef %s'
%
(
fn
[
'name'
]
)
print
commentStr
+
(
'#define %s %s_fn'
%
(
fn
[
'name'
],
fn
[
'name'
]
))
commentStr
=
''
if
'enabled'
in
fn
else
'//'
print
(
'#undef %s'
%
(
fn
[
'name'
])
)
print
(
commentStr
+
(
'#define %s %s_fn'
%
(
fn
[
'name'
],
fn
[
'name'
])
))
params
=
[]
call_params
=
[]
for
i
in
range
(
0
,
len
(
fn
[
'params'
])):
...
...
@@ -251,23 +252,23 @@ def generateInlineWrappers(fns):
call_params
.
append
(
'p%d'
%
(
i
))
if
len
(
fn
[
'ret'
])
==
1
and
fn
[
'ret'
][
0
]
==
'void'
:
print
commentStr
+
(
'inline void %s(%s) { %s_pfn(%s); }'
\
%
(
fn
[
'name'
],
', '
.
join
(
params
),
fn
[
'name'
],
', '
.
join
(
call_params
)))
print
(
commentStr
+
(
'inline void %s(%s) { %s_pfn(%s); }'
\
%
(
fn
[
'name'
],
', '
.
join
(
params
),
fn
[
'name'
],
', '
.
join
(
call_params
)))
)
else
:
print
commentStr
+
(
'inline %s %s(%s) { return %s_pfn(%s); }'
\
%
(
' '
.
join
(
fn
[
'ret'
]),
fn
[
'name'
],
', '
.
join
(
params
),
fn
[
'name'
],
', '
.
join
(
call_params
)))
print
(
commentStr
+
(
'inline %s %s(%s) { return %s_pfn(%s); }'
\
%
(
' '
.
join
(
fn
[
'ret'
]),
fn
[
'name'
],
', '
.
join
(
params
),
fn
[
'name'
],
', '
.
join
(
call_params
)))
)
def
ProcessTemplate
(
inputFile
,
ctx
,
noteLine
=
'//
\n
// AUTOGENERATED, DO NOT EDIT
\n
//'
):
f
=
open
(
inputFile
,
"r"
)
if
noteLine
:
print
noteLine
print
(
noteLine
)
for
line
in
f
:
if
line
.
startswith
(
'@'
):
assert
line
[
-
1
]
==
'
\n
'
line
=
line
[:
-
1
]
# remove '\n'
assert
line
[
-
1
]
==
'@'
name
=
line
[
1
:
-
1
]
assert
ctx
.
has_key
(
name
)
,
name
assert
name
in
ctx
,
name
line
=
ctx
[
name
]
+
(
'
\n
'
if
len
(
ctx
[
name
])
>
0
and
ctx
[
name
][
-
1
]
!=
'
\n
'
else
''
)
sys
.
stdout
.
write
(
line
)
f
.
close
()
modules/core/src/opencl/runtime/generator/parser_cl.py
浏览文件 @
05c1a3d1
...
...
@@ -2,6 +2,7 @@
# usage:
# cat opencl11/cl.h | $0 cl_runtime_opencl11
# cat opencl12/cl.h | $0 cl_runtime_opencl12
from
__future__
import
print_function
import
sys
,
re
;
from
common
import
remove_comments
,
getTokens
,
getParameters
,
postProcessParameters
...
...
@@ -77,7 +78,7 @@ while True:
name
=
parts
[
i
];
i
+=
1
;
fn
[
'name'
]
=
name
print
'name='
+
name
print
(
'name='
+
name
)
params
=
getParameters
(
i
,
parts
)
...
...
@@ -88,7 +89,7 @@ while True:
f
.
close
()
print
'Found %d functions'
%
len
(
fns
)
print
(
'Found %d functions'
%
len
(
fns
)
)
postProcessParameters
(
fns
)
...
...
modules/core/src/opencl/runtime/generator/parser_clamdblas.py
浏览文件 @
05c1a3d1
#!/bin/python
# usage:
# cat clAmdBlas.h | $0
from
__future__
import
print_function
import
sys
,
re
;
from
common
import
remove_comments
,
getTokens
,
getParameters
,
postProcessParameters
...
...
@@ -69,7 +70,7 @@ while True:
name
=
parts
[
i
];
i
+=
1
;
fn
[
'name'
]
=
name
print
'name='
+
name
print
(
'name='
+
name
)
params
=
getParameters
(
i
,
parts
)
...
...
@@ -80,7 +81,7 @@ while True:
f
.
close
()
print
'Found %d functions'
%
len
(
fns
)
print
(
'Found %d functions'
%
len
(
fns
)
)
postProcessParameters
(
fns
)
...
...
modules/core/src/opencl/runtime/generator/parser_clamdfft.py
浏览文件 @
05c1a3d1
#!/bin/python
# usage:
# cat clAmdFft.h | $0
from
__future__
import
print_function
import
sys
,
re
;
from
common
import
remove_comments
,
getTokens
,
getParameters
,
postProcessParameters
...
...
@@ -63,7 +64,7 @@ while True:
name
=
parts
[
i
];
i
+=
1
;
fn
[
'name'
]
=
name
print
'name='
+
name
print
(
'name='
+
name
)
params
=
getParameters
(
i
,
parts
)
...
...
@@ -77,7 +78,7 @@ while True:
f
.
close
()
print
'Found %d functions'
%
len
(
fns
)
print
(
'Found %d functions'
%
len
(
fns
)
)
postProcessParameters
(
fns
)
...
...
modules/dnn/misc/quantize_face_detector.py
浏览文件 @
05c1a3d1
from
__future__
import
print_function
import
argparse
import
cv2
as
cv
import
tensorflow
as
tf
...
...
@@ -199,8 +200,8 @@ with tf.Session() as sess:
outDNN
=
cvNet
.
forward
(
out_nodes
)
outTF
=
sess
.
run
([
mbox_loc
,
mbox_conf_flatten
],
feed_dict
=
{
inp
:
inputData
.
transpose
(
0
,
2
,
3
,
1
)})
print
'Max diff @ locations: %e'
%
np
.
max
(
np
.
abs
(
outDNN
[
0
]
-
outTF
[
0
]
))
print
'Max diff @ confidence: %e'
%
np
.
max
(
np
.
abs
(
outDNN
[
1
]
-
outTF
[
1
]
))
print
(
'Max diff @ locations: %e'
%
np
.
max
(
np
.
abs
(
outDNN
[
0
]
-
outTF
[
0
])
))
print
(
'Max diff @ confidence: %e'
%
np
.
max
(
np
.
abs
(
outDNN
[
1
]
-
outTF
[
1
])
))
# Save a graph
graph_def
=
sess
.
graph
.
as_graph_def
()
...
...
modules/java/check-tests.py
浏览文件 @
05c1a3d1
#!/usr/bin/env python
from
__future__
import
print_function
import
sys
,
os
,
re
classes_ignore_list
=
(
...
...
@@ -148,9 +149,9 @@ class JavaParser:
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
<
2
:
print
"Usage:
\n
"
,
\
print
(
"Usage:
\n
"
,
\
os
.
path
.
basename
(
sys
.
argv
[
0
]),
\
"<Classes/Tests dir1/file1> [<Classes/Tests dir2/file2> ...]
\n
"
,
"Not tested methods are loggedto stdout."
"<Classes/Tests dir1/file1> [<Classes/Tests dir2/file2> ...]
\n
"
,
"Not tested methods are loggedto stdout."
)
exit
(
0
)
parser
=
JavaParser
()
for
x
in
sys
.
argv
[
1
:]:
...
...
modules/ts/misc/perf_tests_timing.py
浏览文件 @
05c1a3d1
#!/usr/bin/env python
from
__future__
import
print_function
import
testlog_parser
,
sys
,
os
,
xml
,
glob
,
re
from
table_formatter
import
*
from
optparse
import
OptionParser
...
...
@@ -154,6 +155,6 @@ if __name__ == "__main__":
htmlPrintFooter
(
sys
.
stdout
)
else
:
if
not
options
.
failedOnly
:
print
'
\n
Overall time: %.2f min
\n
'
%
overall_time
print
(
'
\n
Overall time: %.2f min
\n
'
%
overall_time
)
tbl
.
consolePrintTable
(
sys
.
stdout
)
print
2
*
'
\n
'
print
(
2
*
'
\n
'
)
modules/ts/misc/table_formatter.py
浏览文件 @
05c1a3d1
#!/usr/bin/env python
from
__future__
import
print_function
import
sys
,
re
,
os
.
path
,
cgi
,
stat
,
math
from
optparse
import
OptionParser
from
color
import
getColorizer
,
dummyColorizer
...
...
@@ -723,7 +724,7 @@ def formatValue(val, metric, units = None):
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
<
2
:
print
"Usage:
\n
"
,
os
.
path
.
basename
(
sys
.
argv
[
0
]),
"<log_name>.xml"
print
(
"Usage:
\n
"
,
os
.
path
.
basename
(
sys
.
argv
[
0
]),
"<log_name>.xml"
)
exit
(
0
)
parser
=
OptionParser
()
...
...
modules/ts/misc/testlog_parser.py
浏览文件 @
05c1a3d1
#!/usr/bin/env python
from
__future__
import
print_function
import
collections
import
re
import
os.path
...
...
@@ -108,7 +109,7 @@ class TestInfo(object):
def
dump
(
self
,
units
=
"ms"
):
print
"%s ->
\t\033
[1;31m%s
\033
[0m =
\t
%.2f%s"
%
(
str
(
self
),
self
.
status
,
self
.
get
(
"gmean"
,
units
),
units
)
print
(
"%s ->
\t\033
[1;31m%s
\033
[0m =
\t
%.2f%s"
%
(
str
(
self
),
self
.
status
,
self
.
get
(
"gmean"
,
units
),
units
)
)
def
getName
(
self
):
...
...
@@ -198,22 +199,22 @@ def parseLogFile(filename):
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
<
2
:
print
"Usage:
\n
"
,
os
.
path
.
basename
(
sys
.
argv
[
0
]),
"<log_name>.xml"
print
(
"Usage:
\n
"
,
os
.
path
.
basename
(
sys
.
argv
[
0
]),
"<log_name>.xml"
)
exit
(
0
)
for
arg
in
sys
.
argv
[
1
:]:
print
"Processing {}..."
.
format
(
arg
)
print
(
"Processing {}..."
.
format
(
arg
)
)
run
=
parseLogFile
(
arg
)
print
"Properties:"
print
(
"Properties:"
)
for
(
prop_name
,
prop_value
)
in
run
.
properties
.
items
():
print
"
\t
{} = {}"
.
format
(
prop_name
,
prop_value
)
print
(
"
\t
{} = {}"
.
format
(
prop_name
,
prop_value
)
)
print
"Tests:"
print
(
"Tests:"
)
for
t
in
sorted
(
run
.
tests
):
t
.
dump
()
print
print
()
samples/dnn/fast_neural_style.py
浏览文件 @
05c1a3d1
from
__future__
import
print_function
import
cv2
as
cv
import
numpy
as
np
import
argparse
...
...
@@ -43,7 +44,7 @@ while cv.waitKey(1) < 0:
t
,
_
=
net
.
getPerfProfile
()
freq
=
cv
.
getTickFrequency
()
/
1000
print
t
/
freq
,
'ms'
print
(
t
/
freq
,
'ms'
)
if
args
.
median_filter
:
out
=
cv
.
medianBlur
(
out
,
args
.
median_filter
)
...
...
samples/dnn/mobilenet_ssd_accuracy.py
浏览文件 @
05c1a3d1
from
__future__
import
print_function
# Script to evaluate MobileNet-SSD object detection model trained in TensorFlow
# using both TensorFlow and OpenCV. Example:
#
...
...
@@ -115,14 +116,14 @@ pylab.rcParams['figure.figsize'] = (10.0, 8.0)
annType
=
[
'segm'
,
'bbox'
,
'keypoints'
]
annType
=
annType
[
1
]
#specify type here
prefix
=
'person_keypoints'
if
annType
==
'keypoints'
else
'instances'
print
'Running demo for *%s* results.'
%
(
annType
)
print
(
'Running demo for *%s* results.'
%
(
annType
)
)
#initialize COCO ground truth api
cocoGt
=
COCO
(
args
.
annotations
)
#initialize COCO detections api
for
resFile
in
[
'tf_result.json'
,
'cv_result.json'
]:
print
resFile
print
(
resFile
)
cocoDt
=
cocoGt
.
loadRes
(
resFile
)
cocoEval
=
COCOeval
(
cocoGt
,
cocoDt
,
annType
)
...
...
samples/python/tutorial_code/imgProc/match_template/match_template.py
浏览文件 @
05c1a3d1
from
__future__
import
print_function
import
sys
import
cv2
as
cv
...
...
@@ -16,8 +17,8 @@ max_Trackbar = 5
def
main
(
argv
):
if
(
len
(
sys
.
argv
)
<
3
):
print
'Not enough parameters'
print
'Usage:
\n
match_template_demo.py <image_name> <template_name> [<mask_name>]'
print
(
'Not enough parameters'
)
print
(
'Usage:
\n
match_template_demo.py <image_name> <template_name> [<mask_name>]'
)
return
-
1
## [load_image]
...
...
@@ -33,7 +34,7 @@ def main(argv):
mask
=
cv
.
imread
(
sys
.
argv
[
3
],
cv
.
IMREAD_COLOR
)
if
((
img
is
None
)
or
(
templ
is
None
)
or
(
use_mask
and
(
mask
is
None
))):
print
'Can
\'
t read one of the images'
print
(
'Can
\'
t read one of the images'
)
return
-
1
## [load_image]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录