Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
b4d00c85
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
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看板
未验证
提交
b4d00c85
编写于
7月 29, 2019
作者:
W
wangguanzhong
提交者:
GitHub
7月 29, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add dataset_dir in args (#2956)
上级
493daa9b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
10 deletion
+23
-10
PaddleCV/PaddleDetection/ppdet/data/data_feed.py
PaddleCV/PaddleDetection/ppdet/data/data_feed.py
+4
-4
PaddleCV/PaddleDetection/tools/eval.py
PaddleCV/PaddleDetection/tools/eval.py
+9
-3
PaddleCV/PaddleDetection/tools/train.py
PaddleCV/PaddleDetection/tools/train.py
+10
-3
未找到文件。
PaddleCV/PaddleDetection/ppdet/data/data_feed.py
浏览文件 @
b4d00c85
...
...
@@ -42,7 +42,7 @@ __all__ = [
]
def
create_reader
(
feed
,
max_iter
=
0
):
def
create_reader
(
feed
,
max_iter
=
0
,
args_path
=
None
):
"""
Return iterable data reader.
...
...
@@ -52,11 +52,11 @@ def create_reader(feed, max_iter=0):
# if `DATASET_DIR` does not exists, search ~/.paddle/dataset for a directory
# named `DATASET_DIR` (e.g., coco, pascal), if not present either, download
if
feed
.
dataset
.
dataset_dir
:
dataset_home
=
args_path
if
args_path
else
feed
.
dataset
.
dataset_dir
if
dataset_home
:
annotation
=
getattr
(
feed
.
dataset
,
'annotation'
,
None
)
image_dir
=
getattr
(
feed
.
dataset
,
'image_dir'
,
None
)
dataset_dir
=
get_dataset_path
(
feed
.
dataset
.
dataset_dir
,
annotation
,
image_dir
)
dataset_dir
=
get_dataset_path
(
dataset_home
,
annotation
,
image_dir
)
if
annotation
:
feed
.
dataset
.
annotation
=
os
.
path
.
join
(
dataset_dir
,
annotation
)
if
image_dir
:
...
...
PaddleCV/PaddleDetection/tools/eval.py
浏览文件 @
b4d00c85
...
...
@@ -75,7 +75,7 @@ def main():
fetches
=
model
.
eval
(
feed_vars
)
eval_prog
=
eval_prog
.
clone
(
True
)
reader
=
create_reader
(
eval_feed
)
reader
=
create_reader
(
eval_feed
,
args_path
=
FLAGS
.
dataset_dir
)
pyreader
.
decorate_sample_list_generator
(
reader
,
place
)
# compile program for multi-devices
...
...
@@ -114,8 +114,8 @@ def main():
resolution
=
None
if
'mask'
in
results
[
0
]:
resolution
=
model
.
mask_head
.
resolution
eval_results
(
results
,
eval_feed
,
cfg
.
metric
,
cfg
.
num_classes
,
resolution
,
is_bbox_normalized
,
FLAGS
.
output_file
)
eval_results
(
results
,
eval_feed
,
cfg
.
metric
,
cfg
.
num_classes
,
resolution
,
is_bbox_normalized
,
FLAGS
.
output_file
)
if
__name__
==
'__main__'
:
...
...
@@ -126,5 +126,11 @@ if __name__ == '__main__':
default
=
None
,
type
=
str
,
help
=
"Evaluation file name, default to bbox.json and mask.json."
)
parser
.
add_argument
(
"-d"
,
"--dataset_dir"
,
default
=
None
,
type
=
str
,
help
=
"Dataset path, same as DataFeed.dataset.dataset_dir"
)
FLAGS
=
parser
.
parse_args
()
main
()
PaddleCV/PaddleDetection/tools/train.py
浏览文件 @
b4d00c85
...
...
@@ -105,7 +105,8 @@ def main():
optimizer
=
optim_builder
(
lr
)
optimizer
.
minimize
(
loss
)
train_reader
=
create_reader
(
train_feed
,
cfg
.
max_iters
*
devices_num
)
train_reader
=
create_reader
(
train_feed
,
cfg
.
max_iters
*
devices_num
,
FLAGS
.
dataset_dir
)
train_pyreader
.
decorate_sample_list_generator
(
train_reader
,
place
)
# parse train fetches
...
...
@@ -121,7 +122,7 @@ def main():
fetches
=
model
.
eval
(
feed_vars
)
eval_prog
=
eval_prog
.
clone
(
True
)
eval_reader
=
create_reader
(
eval_feed
)
eval_reader
=
create_reader
(
eval_feed
,
args_path
=
FLAGS
.
dataset_dir
)
eval_pyreader
.
decorate_sample_list_generator
(
eval_reader
,
place
)
# parse eval fetches
...
...
@@ -197,7 +198,7 @@ def main():
resolution
=
None
if
'mask'
in
results
[
0
]:
resolution
=
model
.
mask_head
.
resolution
eval_results
(
results
,
eval_feed
,
cfg
.
metric
,
cfg
.
num_classes
,
eval_results
(
results
,
eval_feed
,
cfg
.
metric
,
cfg
.
num_classes
,
resolution
,
is_bbox_normalized
,
FLAGS
.
output_file
)
train_pyreader
.
reset
()
...
...
@@ -222,5 +223,11 @@ if __name__ == '__main__':
default
=
None
,
type
=
str
,
help
=
"Evaluation file name, default to bbox.json and mask.json."
)
parser
.
add_argument
(
"-d"
,
"--dataset_dir"
,
default
=
None
,
type
=
str
,
help
=
"Dataset path, same as DataFeed.dataset.dataset_dir"
)
FLAGS
=
parser
.
parse_args
()
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录