Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
083ff385
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
083ff385
编写于
5月 12, 2022
作者:
W
wangxinxin08
提交者:
GitHub
5月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
polish args (#5941)
* polish args * fix import bugs
上级
2629454d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
15 addition
and
38 deletion
+15
-38
ppdet/engine/trainer.py
ppdet/engine/trainer.py
+1
-1
ppdet/utils/cli.py
ppdet/utils/cli.py
+7
-0
tools/eval.py
tools/eval.py
+2
-9
tools/eval_mot.py
tools/eval_mot.py
+0
-3
tools/export_model.py
tools/export_model.py
+0
-3
tools/infer.py
tools/infer.py
+2
-6
tools/infer_mot.py
tools/infer_mot.py
+0
-3
tools/train.py
tools/train.py
+3
-13
未找到文件。
ppdet/engine/trainer.py
浏览文件 @
083ff385
...
@@ -204,7 +204,7 @@ class Trainer(object):
...
@@ -204,7 +204,7 @@ class Trainer(object):
classwise
=
self
.
cfg
[
'classwise'
]
if
'classwise'
in
self
.
cfg
else
False
classwise
=
self
.
cfg
[
'classwise'
]
if
'classwise'
in
self
.
cfg
else
False
if
self
.
cfg
.
metric
==
'COCO'
or
self
.
cfg
.
metric
==
"SNIPERCOCO"
:
if
self
.
cfg
.
metric
==
'COCO'
or
self
.
cfg
.
metric
==
"SNIPERCOCO"
:
# TODO: bias should be unified
# TODO: bias should be unified
bias
=
self
.
cfg
[
'bias'
]
if
'bias'
in
self
.
cfg
else
0
bias
=
1
if
self
.
cfg
.
get
(
'bias'
,
False
)
else
0
output_eval
=
self
.
cfg
[
'output_eval'
]
\
output_eval
=
self
.
cfg
[
'output_eval'
]
\
if
'output_eval'
in
self
.
cfg
else
None
if
'output_eval'
in
self
.
cfg
else
None
save_prediction_only
=
self
.
cfg
.
get
(
'save_prediction_only'
,
False
)
save_prediction_only
=
self
.
cfg
.
get
(
'save_prediction_only'
,
False
)
...
...
ppdet/utils/cli.py
浏览文件 @
083ff385
...
@@ -81,6 +81,13 @@ class ArgsParser(ArgumentParser):
...
@@ -81,6 +81,13 @@ class ArgsParser(ArgumentParser):
return
config
return
config
def
merge_args
(
config
,
args
,
exclude_args
=
[
'config'
,
'opt'
,
'slim_config'
]):
for
k
,
v
in
vars
(
args
).
items
():
if
k
not
in
exclude_args
:
config
[
k
]
=
v
return
config
def
print_total_cfg
(
config
):
def
print_total_cfg
(
config
):
modules
=
get_registered_modules
()
modules
=
get_registered_modules
()
color_tty
=
ColorTTY
()
color_tty
=
ColorTTY
()
...
...
tools/eval.py
浏览文件 @
083ff385
...
@@ -31,7 +31,7 @@ import paddle
...
@@ -31,7 +31,7 @@ import paddle
from
ppdet.core.workspace
import
load_config
,
merge_config
from
ppdet.core.workspace
import
load_config
,
merge_config
from
ppdet.utils.check
import
check_gpu
,
check_npu
,
check_xpu
,
check_version
,
check_config
from
ppdet.utils.check
import
check_gpu
,
check_npu
,
check_xpu
,
check_version
,
check_config
from
ppdet.utils.cli
import
ArgsParser
from
ppdet.utils.cli
import
ArgsParser
,
merge_args
from
ppdet.engine
import
Trainer
,
init_parallel_env
from
ppdet.engine
import
Trainer
,
init_parallel_env
from
ppdet.metrics.coco_utils
import
json_eval_results
from
ppdet.metrics.coco_utils
import
json_eval_results
from
ppdet.slim
import
build_slim_model
from
ppdet.slim
import
build_slim_model
...
@@ -109,11 +109,7 @@ def run(FLAGS, cfg):
...
@@ -109,11 +109,7 @@ def run(FLAGS, cfg):
def
main
():
def
main
():
FLAGS
=
parse_args
()
FLAGS
=
parse_args
()
cfg
=
load_config
(
FLAGS
.
config
)
cfg
=
load_config
(
FLAGS
.
config
)
# TODO: bias should be unified
merge_args
(
cfg
,
FLAGS
)
cfg
[
'bias'
]
=
1
if
FLAGS
.
bias
else
0
cfg
[
'classwise'
]
=
True
if
FLAGS
.
classwise
else
False
cfg
[
'output_eval'
]
=
FLAGS
.
output_eval
cfg
[
'save_prediction_only'
]
=
FLAGS
.
save_prediction_only
merge_config
(
FLAGS
.
opt
)
merge_config
(
FLAGS
.
opt
)
# disable npu in config by default
# disable npu in config by default
...
@@ -133,9 +129,6 @@ def main():
...
@@ -133,9 +129,6 @@ def main():
else
:
else
:
place
=
paddle
.
set_device
(
'cpu'
)
place
=
paddle
.
set_device
(
'cpu'
)
if
'norm_type'
in
cfg
and
cfg
[
'norm_type'
]
==
'sync_bn'
and
not
cfg
.
use_gpu
:
cfg
[
'norm_type'
]
=
'bn'
if
FLAGS
.
slim_config
:
if
FLAGS
.
slim_config
:
cfg
=
build_slim_model
(
cfg
,
FLAGS
.
slim_config
,
mode
=
'eval'
)
cfg
=
build_slim_model
(
cfg
,
FLAGS
.
slim_config
,
mode
=
'eval'
)
...
...
tools/eval_mot.py
浏览文件 @
083ff385
...
@@ -121,9 +121,6 @@ def main():
...
@@ -121,9 +121,6 @@ def main():
else
:
else
:
place
=
paddle
.
set_device
(
'cpu'
)
place
=
paddle
.
set_device
(
'cpu'
)
if
'norm_type'
in
cfg
and
cfg
[
'norm_type'
]
==
'sync_bn'
and
not
cfg
.
use_gpu
:
cfg
[
'norm_type'
]
=
'bn'
check_config
(
cfg
)
check_config
(
cfg
)
check_gpu
(
cfg
.
use_gpu
)
check_gpu
(
cfg
.
use_gpu
)
check_npu
(
cfg
.
use_npu
)
check_npu
(
cfg
.
use_npu
)
...
...
tools/export_model.py
浏览文件 @
083ff385
...
@@ -90,9 +90,6 @@ def main():
...
@@ -90,9 +90,6 @@ def main():
paddle
.
set_device
(
"cpu"
)
paddle
.
set_device
(
"cpu"
)
FLAGS
=
parse_args
()
FLAGS
=
parse_args
()
cfg
=
load_config
(
FLAGS
.
config
)
cfg
=
load_config
(
FLAGS
.
config
)
# TODO: to be refined in the future
if
'norm_type'
in
cfg
and
cfg
[
'norm_type'
]
==
'sync_bn'
:
FLAGS
.
opt
[
'norm_type'
]
=
'bn'
merge_config
(
FLAGS
.
opt
)
merge_config
(
FLAGS
.
opt
)
if
FLAGS
.
slim_config
:
if
FLAGS
.
slim_config
:
...
...
tools/infer.py
浏览文件 @
083ff385
...
@@ -32,7 +32,7 @@ import paddle
...
@@ -32,7 +32,7 @@ import paddle
from
ppdet.core.workspace
import
load_config
,
merge_config
from
ppdet.core.workspace
import
load_config
,
merge_config
from
ppdet.engine
import
Trainer
from
ppdet.engine
import
Trainer
from
ppdet.utils.check
import
check_gpu
,
check_npu
,
check_xpu
,
check_version
,
check_config
from
ppdet.utils.check
import
check_gpu
,
check_npu
,
check_xpu
,
check_version
,
check_config
from
ppdet.utils.cli
import
ArgsParser
from
ppdet.utils.cli
import
ArgsParser
,
merge_args
from
ppdet.slim
import
build_slim_model
from
ppdet.slim
import
build_slim_model
from
ppdet.utils.logger
import
setup_logger
from
ppdet.utils.logger
import
setup_logger
...
@@ -137,8 +137,7 @@ def run(FLAGS, cfg):
...
@@ -137,8 +137,7 @@ def run(FLAGS, cfg):
def
main
():
def
main
():
FLAGS
=
parse_args
()
FLAGS
=
parse_args
()
cfg
=
load_config
(
FLAGS
.
config
)
cfg
=
load_config
(
FLAGS
.
config
)
cfg
[
'use_vdl'
]
=
FLAGS
.
use_vdl
merge_args
(
cfg
,
FLAGS
)
cfg
[
'vdl_log_dir'
]
=
FLAGS
.
vdl_log_dir
merge_config
(
FLAGS
.
opt
)
merge_config
(
FLAGS
.
opt
)
# disable npu in config by default
# disable npu in config by default
...
@@ -158,9 +157,6 @@ def main():
...
@@ -158,9 +157,6 @@ def main():
else
:
else
:
place
=
paddle
.
set_device
(
'cpu'
)
place
=
paddle
.
set_device
(
'cpu'
)
if
'norm_type'
in
cfg
and
cfg
[
'norm_type'
]
==
'sync_bn'
and
not
cfg
.
use_gpu
:
cfg
[
'norm_type'
]
=
'bn'
if
FLAGS
.
slim_config
:
if
FLAGS
.
slim_config
:
cfg
=
build_slim_model
(
cfg
,
FLAGS
.
slim_config
,
mode
=
'test'
)
cfg
=
build_slim_model
(
cfg
,
FLAGS
.
slim_config
,
mode
=
'test'
)
...
...
tools/infer_mot.py
浏览文件 @
083ff385
...
@@ -133,9 +133,6 @@ def main():
...
@@ -133,9 +133,6 @@ def main():
else
:
else
:
place
=
paddle
.
set_device
(
'cpu'
)
place
=
paddle
.
set_device
(
'cpu'
)
if
'norm_type'
in
cfg
and
cfg
[
'norm_type'
]
==
'sync_bn'
and
not
cfg
.
use_gpu
:
cfg
[
'norm_type'
]
=
'bn'
check_config
(
cfg
)
check_config
(
cfg
)
check_gpu
(
cfg
.
use_gpu
)
check_gpu
(
cfg
.
use_gpu
)
check_npu
(
cfg
.
use_npu
)
check_npu
(
cfg
.
use_npu
)
...
...
tools/train.py
浏览文件 @
083ff385
...
@@ -33,14 +33,14 @@ from ppdet.core.workspace import load_config, merge_config
...
@@ -33,14 +33,14 @@ from ppdet.core.workspace import load_config, merge_config
from
ppdet.engine
import
Trainer
,
init_parallel_env
,
set_random_seed
,
init_fleet_env
from
ppdet.engine
import
Trainer
,
init_parallel_env
,
set_random_seed
,
init_fleet_env
from
ppdet.slim
import
build_slim_model
from
ppdet.slim
import
build_slim_model
import
ppdet.utils.cli
as
cli
from
ppdet.utils.cli
import
ArgsParser
,
merge_args
import
ppdet.utils.check
as
check
import
ppdet.utils.check
as
check
from
ppdet.utils.logger
import
setup_logger
from
ppdet.utils.logger
import
setup_logger
logger
=
setup_logger
(
'train'
)
logger
=
setup_logger
(
'train'
)
def
parse_args
():
def
parse_args
():
parser
=
cli
.
ArgsParser
()
parser
=
ArgsParser
()
parser
.
add_argument
(
parser
.
add_argument
(
"--eval"
,
"--eval"
,
action
=
'store_true'
,
action
=
'store_true'
,
...
@@ -130,14 +130,7 @@ def run(FLAGS, cfg):
...
@@ -130,14 +130,7 @@ def run(FLAGS, cfg):
def
main
():
def
main
():
FLAGS
=
parse_args
()
FLAGS
=
parse_args
()
cfg
=
load_config
(
FLAGS
.
config
)
cfg
=
load_config
(
FLAGS
.
config
)
cfg
[
'amp'
]
=
FLAGS
.
amp
merge_args
(
cfg
,
FLAGS
)
cfg
[
'fleet'
]
=
FLAGS
.
fleet
cfg
[
'use_vdl'
]
=
FLAGS
.
use_vdl
cfg
[
'vdl_log_dir'
]
=
FLAGS
.
vdl_log_dir
cfg
[
'save_prediction_only'
]
=
FLAGS
.
save_prediction_only
cfg
[
'profiler_options'
]
=
FLAGS
.
profiler_options
cfg
[
'save_proposals'
]
=
FLAGS
.
save_proposals
cfg
[
'proposals_path'
]
=
FLAGS
.
proposals_path
merge_config
(
FLAGS
.
opt
)
merge_config
(
FLAGS
.
opt
)
# disable npu in config by default
# disable npu in config by default
...
@@ -157,9 +150,6 @@ def main():
...
@@ -157,9 +150,6 @@ def main():
else
:
else
:
place
=
paddle
.
set_device
(
'cpu'
)
place
=
paddle
.
set_device
(
'cpu'
)
if
'norm_type'
in
cfg
and
cfg
[
'norm_type'
]
==
'sync_bn'
and
not
cfg
.
use_gpu
:
cfg
[
'norm_type'
]
=
'bn'
if
FLAGS
.
slim_config
:
if
FLAGS
.
slim_config
:
cfg
=
build_slim_model
(
cfg
,
FLAGS
.
slim_config
)
cfg
=
build_slim_model
(
cfg
,
FLAGS
.
slim_config
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录