Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
22c25768
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
22c25768
编写于
9月 09, 2019
作者:
W
wangguanzhong
提交者:
GitHub
9月 09, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
print total config (#3300)
上级
8aa50fde
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
4 deletion
+28
-4
tools/__init__.py
tools/__init__.py
+13
-0
tools/configure.py
tools/configure.py
+7
-3
tools/eval.py
tools/eval.py
+2
-0
tools/infer.py
tools/infer.py
+4
-0
tools/train.py
tools/train.py
+2
-1
未找到文件。
tools/__init__.py
0 → 100644
浏览文件 @
22c25768
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
tools/configure.py
浏览文件 @
22c25768
...
@@ -151,9 +151,7 @@ def generate_config(**kwargs):
...
@@ -151,9 +151,7 @@ def generate_config(**kwargs):
print
(
dump_config
(
s
,
minimal
))
print
(
dump_config
(
s
,
minimal
))
# FIXME this is pretty hackish, maybe implement a custom YAML printer?
def
print_total_cfg
(
config
):
def
analyze_config
(
**
kwargs
):
config
=
load_config
(
kwargs
[
'file'
])
modules
=
get_registered_modules
()
modules
=
get_registered_modules
()
green
=
'___{}___'
.
format
(
color_tty
.
colors
.
index
(
'green'
)
+
31
)
green
=
'___{}___'
.
format
(
color_tty
.
colors
.
index
(
'green'
)
+
31
)
...
@@ -222,6 +220,12 @@ def analyze_config(**kwargs):
...
@@ -222,6 +220,12 @@ def analyze_config(**kwargs):
print
(
buffer
)
print
(
buffer
)
# FIXME this is pretty hackish, maybe implement a custom YAML printer?
def
analyze_config
(
**
kwargs
):
config
=
load_config
(
kwargs
[
'file'
])
print_total_cfg
(
config
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
argv
=
sys
.
argv
[
1
:]
argv
=
sys
.
argv
[
1
:]
...
...
tools/eval.py
浏览文件 @
22c25768
...
@@ -33,6 +33,7 @@ set_paddle_flags(
...
@@ -33,6 +33,7 @@ set_paddle_flags(
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
from
tools.configure
import
print_total_cfg
from
ppdet.utils.eval_utils
import
parse_fetches
,
eval_run
,
eval_results
,
json_eval_results
from
ppdet.utils.eval_utils
import
parse_fetches
,
eval_run
,
eval_results
,
json_eval_results
import
ppdet.utils.checkpoint
as
checkpoint
import
ppdet.utils.checkpoint
as
checkpoint
from
ppdet.utils.cli
import
ArgsParser
from
ppdet.utils.cli
import
ArgsParser
...
@@ -61,6 +62,7 @@ def main():
...
@@ -61,6 +62,7 @@ def main():
# check if set use_gpu=True in paddlepaddle cpu version
# check if set use_gpu=True in paddlepaddle cpu version
check_gpu
(
cfg
.
use_gpu
)
check_gpu
(
cfg
.
use_gpu
)
print_total_cfg
(
cfg
)
if
'eval_feed'
not
in
cfg
:
if
'eval_feed'
not
in
cfg
:
eval_feed
=
create
(
main_arch
+
'EvalFeed'
)
eval_feed
=
create
(
main_arch
+
'EvalFeed'
)
...
...
tools/infer.py
浏览文件 @
22c25768
...
@@ -22,11 +22,13 @@ import glob
...
@@ -22,11 +22,13 @@ import glob
import
numpy
as
np
import
numpy
as
np
from
PIL
import
Image
from
PIL
import
Image
def
set_paddle_flags
(
**
kwargs
):
def
set_paddle_flags
(
**
kwargs
):
for
key
,
value
in
kwargs
.
items
():
for
key
,
value
in
kwargs
.
items
():
if
os
.
environ
.
get
(
key
,
None
)
is
None
:
if
os
.
environ
.
get
(
key
,
None
)
is
None
:
os
.
environ
[
key
]
=
str
(
value
)
os
.
environ
[
key
]
=
str
(
value
)
# NOTE(paddle-dev): All of these flags should be set before
# NOTE(paddle-dev): All of these flags should be set before
# `import paddle`. Otherwise, it would not take any effect.
# `import paddle`. Otherwise, it would not take any effect.
set_paddle_flags
(
set_paddle_flags
(
...
@@ -35,6 +37,7 @@ set_paddle_flags(
...
@@ -35,6 +37,7 @@ set_paddle_flags(
from
paddle
import
fluid
from
paddle
import
fluid
from
tools.configure
import
print_total_cfg
from
ppdet.core.workspace
import
load_config
,
merge_config
,
create
from
ppdet.core.workspace
import
load_config
,
merge_config
,
create
from
ppdet.modeling.model_input
import
create_feed
from
ppdet.modeling.model_input
import
create_feed
from
ppdet.data.data_feed
import
create_reader
from
ppdet.data.data_feed
import
create_reader
...
@@ -147,6 +150,7 @@ def main():
...
@@ -147,6 +150,7 @@ def main():
# check if set use_gpu=True in paddlepaddle cpu version
# check if set use_gpu=True in paddlepaddle cpu version
check_gpu
(
cfg
.
use_gpu
)
check_gpu
(
cfg
.
use_gpu
)
print_total_cfg
(
cfg
)
if
'test_feed'
not
in
cfg
:
if
'test_feed'
not
in
cfg
:
test_feed
=
create
(
main_arch
+
'TestFeed'
)
test_feed
=
create
(
main_arch
+
'TestFeed'
)
...
...
tools/train.py
浏览文件 @
22c25768
...
@@ -21,6 +21,7 @@ import time
...
@@ -21,6 +21,7 @@ import time
import
numpy
as
np
import
numpy
as
np
import
datetime
import
datetime
from
collections
import
deque
from
collections
import
deque
from
tools.configure
import
print_total_cfg
def
set_paddle_flags
(
**
kwargs
):
def
set_paddle_flags
(
**
kwargs
):
...
@@ -36,7 +37,6 @@ set_paddle_flags(
...
@@ -36,7 +37,6 @@ set_paddle_flags(
)
)
from
paddle
import
fluid
from
paddle
import
fluid
from
ppdet.core.workspace
import
load_config
,
merge_config
,
create
from
ppdet.core.workspace
import
load_config
,
merge_config
,
create
from
ppdet.data.data_feed
import
create_reader
from
ppdet.data.data_feed
import
create_reader
...
@@ -66,6 +66,7 @@ def main():
...
@@ -66,6 +66,7 @@ def main():
# check if set use_gpu=True in paddlepaddle cpu version
# check if set use_gpu=True in paddlepaddle cpu version
check_gpu
(
cfg
.
use_gpu
)
check_gpu
(
cfg
.
use_gpu
)
print_total_cfg
(
cfg
)
if
cfg
.
use_gpu
:
if
cfg
.
use_gpu
:
devices_num
=
fluid
.
core
.
get_cuda_device_count
()
devices_num
=
fluid
.
core
.
get_cuda_device_count
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录