Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
238ed4fb
M
models
项目概览
PaddlePaddle
/
models
大约 2 年 前同步成功
通知
232
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
238ed4fb
编写于
7月 10, 2019
作者:
L
LielinJiang
提交者:
qingqing01
7月 10, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add model check function (#2729)
上级
5987726d
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
74 addition
and
13 deletion
+74
-13
PaddleCV/face_detection/train.py
PaddleCV/face_detection/train.py
+2
-1
PaddleCV/face_detection/utility.py
PaddleCV/face_detection/utility.py
+13
-1
PaddleCV/human_pose_estimation/test.py
PaddleCV/human_pose_estimation/test.py
+1
-0
PaddleCV/human_pose_estimation/train.py
PaddleCV/human_pose_estimation/train.py
+1
-0
PaddleCV/human_pose_estimation/utils/utility.py
PaddleCV/human_pose_estimation/utils/utility.py
+13
-1
PaddleCV/human_pose_estimation/val.py
PaddleCV/human_pose_estimation/val.py
+1
-0
PaddleCV/metric_learning/eval.py
PaddleCV/metric_learning/eval.py
+2
-1
PaddleCV/metric_learning/infer.py
PaddleCV/metric_learning/infer.py
+2
-1
PaddleCV/metric_learning/train_elem.py
PaddleCV/metric_learning/train_elem.py
+2
-1
PaddleCV/metric_learning/train_pair.py
PaddleCV/metric_learning/train_pair.py
+2
-1
PaddleCV/metric_learning/utility.py
PaddleCV/metric_learning/utility.py
+13
-1
PaddleCV/ssd/eval.py
PaddleCV/ssd/eval.py
+3
-1
PaddleCV/ssd/infer.py
PaddleCV/ssd/infer.py
+3
-1
PaddleCV/ssd/train.py
PaddleCV/ssd/train.py
+3
-1
PaddleCV/ssd/utility.py
PaddleCV/ssd/utility.py
+13
-2
未找到文件。
PaddleCV/face_detection/train.py
浏览文件 @
238ed4fb
...
@@ -13,7 +13,7 @@ import paddle
...
@@ -13,7 +13,7 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
from
pyramidbox
import
PyramidBox
from
pyramidbox
import
PyramidBox
import
reader
import
reader
from
utility
import
add_arguments
,
print_arguments
from
utility
import
add_arguments
,
print_arguments
,
check_cuda
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
@@ -247,6 +247,7 @@ def get_cards(args):
...
@@ -247,6 +247,7 @@ def get_cards(args):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
print_arguments
(
args
)
print_arguments
(
args
)
check_cuda
(
args
.
use_gpu
)
data_dir
=
os
.
path
.
join
(
args
.
data_dir
,
'WIDER_train/images/'
)
data_dir
=
os
.
path
.
join
(
args
.
data_dir
,
'WIDER_train/images/'
)
train_file_list
=
os
.
path
.
join
(
args
.
data_dir
,
train_file_list
=
os
.
path
.
join
(
args
.
data_dir
,
...
...
PaddleCV/face_detection/utility.py
浏览文件 @
238ed4fb
...
@@ -17,7 +17,8 @@ from __future__ import division
...
@@ -17,7 +17,8 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
import
distutils.util
import
distutils.util
import
six
import
six
import
sys
import
paddle.fluid
as
fluid
def
print_arguments
(
args
):
def
print_arguments
(
args
):
"""Print argparse's arguments.
"""Print argparse's arguments.
...
@@ -58,3 +59,14 @@ def add_arguments(argname, type, default, help, argparser, **kwargs):
...
@@ -58,3 +59,14 @@ def add_arguments(argname, type, default, help, argparser, **kwargs):
type
=
type
,
type
=
type
,
help
=
help
+
' Default: %(default)s.'
,
help
=
help
+
' Default: %(default)s.'
,
**
kwargs
)
**
kwargs
)
def
check_cuda
(
use_cuda
,
err
=
\
"
\n
You can not set use_cuda = True in the model because you are using paddlepaddle-cpu.
\n
\
Please: 1. Install paddlepaddle-gpu to run your models on GPU or 2. Set use_cuda = False to run models on CPU.
\n
"
):
try
:
if
use_cuda
==
True
and
fluid
.
is_compiled_with_cuda
()
==
False
:
print
(
err
)
sys
.
exit
(
1
)
except
Exception
as
e
:
pass
\ No newline at end of file
PaddleCV/human_pose_estimation/test.py
浏览文件 @
238ed4fb
...
@@ -133,4 +133,5 @@ def test(args):
...
@@ -133,4 +133,5 @@ def test(args):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
check_cuda
(
args
.
use_gpu
)
test
(
args
)
test
(
args
)
PaddleCV/human_pose_estimation/train.py
浏览文件 @
238ed4fb
...
@@ -175,5 +175,6 @@ def train(args):
...
@@ -175,5 +175,6 @@ def train(args):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
check_cuda
(
args
.
use_gpu
)
train
(
args
)
train
(
args
)
PaddleCV/human_pose_estimation/utils/utility.py
浏览文件 @
238ed4fb
...
@@ -23,7 +23,8 @@ import distutils.util
...
@@ -23,7 +23,8 @@ import distutils.util
import
numpy
as
np
import
numpy
as
np
import
cv2
import
cv2
from
pathlib
import
Path
from
pathlib
import
Path
import
sys
import
paddle.fluid
as
fluid
def
print_arguments
(
args
):
def
print_arguments
(
args
):
"""Print argparse's arguments.
"""Print argparse's arguments.
...
@@ -395,3 +396,14 @@ class AverageMeter(object):
...
@@ -395,3 +396,14 @@ class AverageMeter(object):
self
.
sum
+=
val
*
n
self
.
sum
+=
val
*
n
self
.
count
+=
n
self
.
count
+=
n
self
.
avg
=
self
.
sum
/
self
.
count
if
self
.
count
!=
0
else
0
self
.
avg
=
self
.
sum
/
self
.
count
if
self
.
count
!=
0
else
0
def
check_cuda
(
use_cuda
,
err
=
\
"
\n
You can not set use_cuda = True in the model because you are using paddlepaddle-cpu.
\n
\
Please: 1. Install paddlepaddle-gpu to run your models on GPU or 2. Set use_cuda = False to run models on CPU.
\n
"
):
try
:
if
use_cuda
==
True
and
fluid
.
is_compiled_with_cuda
()
==
False
:
print
(
err
)
sys
.
exit
(
1
)
except
Exception
as
e
:
pass
PaddleCV/human_pose_estimation/val.py
浏览文件 @
238ed4fb
...
@@ -230,4 +230,5 @@ def valid(args):
...
@@ -230,4 +230,5 @@ def valid(args):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
check_cuda
(
args
.
use_gpu
)
valid
(
args
)
valid
(
args
)
PaddleCV/metric_learning/eval.py
浏览文件 @
238ed4fb
...
@@ -13,7 +13,7 @@ import paddle
...
@@ -13,7 +13,7 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
import
models
import
models
import
reader
import
reader
from
utility
import
add_arguments
,
print_arguments
from
utility
import
add_arguments
,
print_arguments
,
check_cuda
from
utility
import
fmt_time
,
recall_topk
from
utility
import
fmt_time
,
recall_topk
# yapf: disable
# yapf: disable
...
@@ -93,6 +93,7 @@ def eval(args):
...
@@ -93,6 +93,7 @@ def eval(args):
def
main
():
def
main
():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
print_arguments
(
args
)
print_arguments
(
args
)
check_cuda
(
args
.
use_gpu
)
eval
(
args
)
eval
(
args
)
...
...
PaddleCV/metric_learning/infer.py
浏览文件 @
238ed4fb
...
@@ -13,7 +13,7 @@ import paddle
...
@@ -13,7 +13,7 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
import
models
import
models
import
reader
import
reader
from
utility
import
add_arguments
,
print_arguments
from
utility
import
add_arguments
,
print_arguments
,
check_cuda
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
@@ -77,6 +77,7 @@ def infer(args):
...
@@ -77,6 +77,7 @@ def infer(args):
def
main
():
def
main
():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
print_arguments
(
args
)
print_arguments
(
args
)
check_cuda
(
args
.
use_gpu
)
infer
(
args
)
infer
(
args
)
...
...
PaddleCV/metric_learning/train_elem.py
浏览文件 @
238ed4fb
...
@@ -19,7 +19,7 @@ import reader
...
@@ -19,7 +19,7 @@ import reader
from
losses
import
SoftmaxLoss
from
losses
import
SoftmaxLoss
from
losses
import
ArcMarginLoss
from
losses
import
ArcMarginLoss
from
utility
import
add_arguments
,
print_arguments
from
utility
import
add_arguments
,
print_arguments
from
utility
import
fmt_time
,
recall_topk
,
get_gpu_num
from
utility
import
fmt_time
,
recall_topk
,
get_gpu_num
,
check_cuda
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
@@ -283,6 +283,7 @@ def initlogging():
...
@@ -283,6 +283,7 @@ def initlogging():
def
main
():
def
main
():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
print_arguments
(
args
)
print_arguments
(
args
)
check_cuda
(
args
.
use_gpu
)
train_async
(
args
)
train_async
(
args
)
...
...
PaddleCV/metric_learning/train_pair.py
浏览文件 @
238ed4fb
...
@@ -21,7 +21,7 @@ from losses import QuadrupletLoss
...
@@ -21,7 +21,7 @@ from losses import QuadrupletLoss
from
losses
import
EmlLoss
from
losses
import
EmlLoss
from
losses
import
NpairsLoss
from
losses
import
NpairsLoss
from
utility
import
add_arguments
,
print_arguments
from
utility
import
add_arguments
,
print_arguments
from
utility
import
fmt_time
,
recall_topk
,
get_gpu_num
from
utility
import
fmt_time
,
recall_topk
,
get_gpu_num
,
check_cuda
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
@@ -275,6 +275,7 @@ def initlogging():
...
@@ -275,6 +275,7 @@ def initlogging():
def
main
():
def
main
():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
print_arguments
(
args
)
print_arguments
(
args
)
check_cuda
(
args
.
use_gpu
)
train_async
(
args
)
train_async
(
args
)
...
...
PaddleCV/metric_learning/utility.py
浏览文件 @
238ed4fb
...
@@ -23,7 +23,8 @@ import time
...
@@ -23,7 +23,8 @@ import time
import
subprocess
import
subprocess
import
distutils.util
import
distutils.util
import
numpy
as
np
import
numpy
as
np
import
sys
import
paddle.fluid
as
fluid
from
paddle.fluid
import
core
from
paddle.fluid
import
core
...
@@ -101,3 +102,14 @@ def get_gpu_num():
...
@@ -101,3 +102,14 @@ def get_gpu_num():
[
str
.
encode
(
'nvidia-smi'
),
str
.
encode
(
'-L'
)]).
decode
(
'utf-8'
).
count
(
'
\n
'
)
[
str
.
encode
(
'nvidia-smi'
),
str
.
encode
(
'-L'
)]).
decode
(
'utf-8'
).
count
(
'
\n
'
)
return
devicenum
return
devicenum
def
check_cuda
(
use_cuda
,
err
=
\
"
\n
You can not set use_cuda = True in the model because you are using paddlepaddle-cpu.
\n
\
Please: 1. Install paddlepaddle-gpu to run your models on GPU or 2. Set use_cuda = False to run models on CPU.
\n
"
):
try
:
if
use_cuda
==
True
and
fluid
.
is_compiled_with_cuda
()
==
False
:
print
(
err
)
sys
.
exit
(
1
)
except
Exception
as
e
:
pass
PaddleCV/ssd/eval.py
浏览文件 @
238ed4fb
...
@@ -9,7 +9,7 @@ import paddle
...
@@ -9,7 +9,7 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
import
reader
import
reader
from
mobilenet_ssd
import
build_mobilenet_ssd
from
mobilenet_ssd
import
build_mobilenet_ssd
from
utility
import
add_arguments
,
print_arguments
from
utility
import
add_arguments
,
print_arguments
,
check_cuda
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
@@ -105,6 +105,8 @@ if __name__ == '__main__':
...
@@ -105,6 +105,8 @@ if __name__ == '__main__':
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
print_arguments
(
args
)
print_arguments
(
args
)
check_cuda
(
args
.
use_gpu
)
data_dir
=
'data/pascalvoc'
data_dir
=
'data/pascalvoc'
test_list
=
'test.txt'
test_list
=
'test.txt'
label_file
=
'label_list'
label_file
=
'label_list'
...
...
PaddleCV/ssd/infer.py
浏览文件 @
238ed4fb
...
@@ -11,7 +11,7 @@ import paddle
...
@@ -11,7 +11,7 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
import
reader
import
reader
from
mobilenet_ssd
import
build_mobilenet_ssd
from
mobilenet_ssd
import
build_mobilenet_ssd
from
utility
import
add_arguments
,
print_arguments
from
utility
import
add_arguments
,
print_arguments
,
check_cuda
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
@@ -117,6 +117,8 @@ if __name__ == '__main__':
...
@@ -117,6 +117,8 @@ if __name__ == '__main__':
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
print_arguments
(
args
)
print_arguments
(
args
)
check_cuda
(
args
.
use_gpu
)
data_dir
=
'data/pascalvoc'
data_dir
=
'data/pascalvoc'
label_file
=
'label_list'
label_file
=
'label_list'
...
...
PaddleCV/ssd/train.py
浏览文件 @
238ed4fb
...
@@ -11,7 +11,7 @@ import paddle
...
@@ -11,7 +11,7 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
import
reader
import
reader
from
mobilenet_ssd
import
build_mobilenet_ssd
from
mobilenet_ssd
import
build_mobilenet_ssd
from
utility
import
add_arguments
,
print_arguments
from
utility
import
add_arguments
,
print_arguments
,
check_cuda
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
@@ -288,6 +288,8 @@ def main():
...
@@ -288,6 +288,8 @@ def main():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
print_arguments
(
args
)
print_arguments
(
args
)
check_cuda
(
args
.
use_gpu
)
data_dir
=
args
.
data_dir
data_dir
=
args
.
data_dir
dataset
=
args
.
dataset
dataset
=
args
.
dataset
assert
dataset
in
[
'pascalvoc'
,
'coco2014'
,
'coco2017'
]
assert
dataset
in
[
'pascalvoc'
,
'coco2014'
,
'coco2017'
]
...
...
PaddleCV/ssd/utility.py
浏览文件 @
238ed4fb
...
@@ -18,9 +18,9 @@ from __future__ import division
...
@@ -18,9 +18,9 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
import
distutils.util
import
distutils.util
import
numpy
as
np
import
sys
import
six
import
six
from
paddle.fluid
import
core
import
paddle.fluid
as
fluid
def
print_arguments
(
args
):
def
print_arguments
(
args
):
...
@@ -62,3 +62,14 @@ def add_arguments(argname, type, default, help, argparser, **kwargs):
...
@@ -62,3 +62,14 @@ def add_arguments(argname, type, default, help, argparser, **kwargs):
type
=
type
,
type
=
type
,
help
=
help
+
' Default: %(default)s.'
,
help
=
help
+
' Default: %(default)s.'
,
**
kwargs
)
**
kwargs
)
def
check_cuda
(
use_cuda
,
err
=
\
"
\n
You can not set use_cuda = True in the model because you are using paddlepaddle-cpu.
\n
\
Please: 1. Install paddlepaddle-gpu to run your models on GPU or 2. Set use_cuda = False to run models on CPU.
\n
"
):
try
:
if
use_cuda
==
True
and
fluid
.
is_compiled_with_cuda
()
==
False
:
print
(
err
)
sys
.
exit
(
1
)
except
Exception
as
e
:
pass
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录