Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSeg
提交
727d93ad
P
PaddleSeg
项目概览
PaddlePaddle
/
PaddleSeg
通知
285
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
727d93ad
编写于
8月 11, 2020
作者:
C
chenguowei01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update annotation
上级
8d371858
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
47 deletion
+31
-47
dygraph/datasets/ade.py
dygraph/datasets/ade.py
+5
-5
dygraph/datasets/cityscapes.py
dygraph/datasets/cityscapes.py
+1
-1
dygraph/datasets/dataset.py
dygraph/datasets/dataset.py
+9
-8
dygraph/datasets/optic_disc_seg.py
dygraph/datasets/optic_disc_seg.py
+5
-4
dygraph/datasets/voc.py
dygraph/datasets/voc.py
+5
-5
dygraph/infer.py
dygraph/infer.py
+2
-2
dygraph/train.py
dygraph/train.py
+2
-9
dygraph/val.py
dygraph/val.py
+2
-13
未找到文件。
dygraph/datasets/ade.py
浏览文件 @
727d93ad
...
...
@@ -30,7 +30,7 @@ class ADE20K(Dataset):
dataset_root: The dataset directory.
mode: Which part of dataset to use.. it is one of ('train', 'val'). Default: 'train'.
transforms: Transforms for image.
download: Whether to download dataset if
dataset_root
is None.
download: Whether to download dataset if
`dataset_root`
is None.
"""
def
__init__
(
self
,
...
...
@@ -46,23 +46,23 @@ class ADE20K(Dataset):
if
mode
.
lower
()
not
in
[
'train'
,
'val'
]:
raise
Exception
(
"
mode
should be one of ('train', 'val') in ADE20K dataset, but got {}."
"
`mode`
should be one of ('train', 'val') in ADE20K dataset, but got {}."
.
format
(
mode
))
if
self
.
transforms
is
None
:
raise
Exception
(
"
transforms
is necessary, but it is None."
)
raise
Exception
(
"
`transforms`
is necessary, but it is None."
)
if
self
.
dataset_root
is
None
:
if
not
download
:
raise
Exception
(
"
dataset_root
not set and auto download disabled."
)
"
`dataset_root`
not set and auto download disabled."
)
self
.
dataset_root
=
download_file_and_uncompress
(
url
=
URL
,
savepath
=
DATA_HOME
,
extrapath
=
DATA_HOME
,
extraname
=
'ADEChallengeData2016'
)
elif
not
os
.
path
.
exists
(
self
.
dataset_root
):
raise
Exception
(
'there is not
dataset_root
: {}.'
.
format
(
raise
Exception
(
'there is not
`dataset_root`
: {}.'
.
format
(
self
.
dataset_root
))
if
mode
==
'train'
:
...
...
dygraph/datasets/cityscapes.py
浏览文件 @
727d93ad
...
...
@@ -53,7 +53,7 @@ class Cityscapes(Dataset):
mode
))
if
self
.
transforms
is
None
:
raise
Exception
(
"
transforms
is necessary, but it is None."
)
raise
Exception
(
"
`transforms`
is necessary, but it is None."
)
img_dir
=
os
.
path
.
join
(
self
.
dataset_root
,
'leftImg8bit'
)
grt_dir
=
os
.
path
.
join
(
self
.
dataset_root
,
'gtFine'
)
...
...
dygraph/datasets/dataset.py
浏览文件 @
727d93ad
...
...
@@ -63,39 +63,40 @@ class Dataset(fluid.io.Dataset):
mode
))
if
self
.
transforms
is
None
:
raise
Exception
(
"
transforms
is necessary, but it is None."
)
raise
Exception
(
"
`transforms`
is necessary, but it is None."
)
self
.
dataset_root
=
dataset_root
if
not
os
.
path
.
exists
(
self
.
dataset_root
):
raise
Exception
(
'there is not
dataset_root
: {}.'
.
format
(
raise
Exception
(
'there is not
`dataset_root`
: {}.'
.
format
(
self
.
dataset_root
))
if
mode
==
'train'
:
if
train_list
is
None
:
raise
Exception
(
'When
mode is "train", train_list
is necessary, but it is None.'
'When
`mode` is "train", `train_list`
is necessary, but it is None.'
)
elif
not
os
.
path
.
exists
(
train_list
):
raise
Exception
(
'
train_list
is not found: {}'
.
format
(
train_list
))
'
`train_list`
is not found: {}'
.
format
(
train_list
))
else
:
file_list
=
train_list
elif
mode
==
'val'
:
if
val_list
is
None
:
raise
Exception
(
'When
mode is "val", val_list
is necessary, but it is None.'
'When
`mode` is "val", `val_list`
is necessary, but it is None.'
)
elif
not
os
.
path
.
exists
(
val_list
):
raise
Exception
(
'
val_list
is not found: {}'
.
format
(
val_list
))
raise
Exception
(
'
`val_list`
is not found: {}'
.
format
(
val_list
))
else
:
file_list
=
val_list
else
:
if
test_list
is
None
:
raise
Exception
(
'When
mode is "test", test_list
is necessary, but it is None.'
'When
`mode` is "test", `test_list`
is necessary, but it is None.'
)
elif
not
os
.
path
.
exists
(
test_list
):
raise
Exception
(
'test_list is not found: {}'
.
format
(
test_list
))
raise
Exception
(
'`test_list` is not found: {}'
.
format
(
test_list
))
else
:
file_list
=
test_list
...
...
dygraph/datasets/optic_disc_seg.py
浏览文件 @
727d93ad
...
...
@@ -35,19 +35,20 @@ class OpticDiscSeg(Dataset):
if
mode
.
lower
()
not
in
[
'train'
,
'val'
,
'test'
]:
raise
Exception
(
"
mode
should be 'train', 'val' or 'test', but got {}."
.
format
(
"
`mode`
should be 'train', 'val' or 'test', but got {}."
.
format
(
mode
))
if
self
.
transforms
is
None
:
raise
Exception
(
"
transforms
is necessary, but it is None."
)
raise
Exception
(
"
`transforms`
is necessary, but it is None."
)
if
self
.
dataset_root
is
None
:
if
not
download
:
raise
Exception
(
"data_file not set and auto download disabled."
)
raise
Exception
(
"`data_root` not set and auto download disabled."
)
self
.
dataset_root
=
download_file_and_uncompress
(
url
=
URL
,
savepath
=
DATA_HOME
,
extrapath
=
DATA_HOME
)
elif
not
os
.
path
.
exists
(
self
.
dataset_root
):
raise
Exception
(
'there is not
dataset_root
: {}.'
.
format
(
raise
Exception
(
'there is not
`dataset_root`
: {}.'
.
format
(
self
.
dataset_root
))
if
mode
==
'train'
:
...
...
dygraph/datasets/voc.py
浏览文件 @
727d93ad
...
...
@@ -43,23 +43,23 @@ class PascalVOC(Dataset):
if
mode
.
lower
()
not
in
[
'train'
,
'trainval'
,
'trainaug'
,
'val'
]:
raise
Exception
(
"
mode
should be one of ('train', 'trainval', 'trainaug', 'val') in PascalVOC dataset, but got {}."
"
`mode`
should be one of ('train', 'trainval', 'trainaug', 'val') in PascalVOC dataset, but got {}."
.
format
(
mode
))
if
self
.
transforms
is
None
:
raise
Exception
(
"
transforms
is necessary, but it is None."
)
raise
Exception
(
"
`transforms`
is necessary, but it is None."
)
if
self
.
dataset_root
is
None
:
if
not
download
:
raise
Exception
(
"
dataset_root
not set and auto download disabled."
)
"
`dataset_root`
not set and auto download disabled."
)
self
.
dataset_root
=
download_file_and_uncompress
(
url
=
URL
,
savepath
=
DATA_HOME
,
extrapath
=
DATA_HOME
,
extraname
=
'VOCdevkit'
)
elif
not
os
.
path
.
exists
(
self
.
dataset_root
):
raise
Exception
(
'there is not
dataset_root
: {}.'
.
format
(
raise
Exception
(
'there is not
`dataset_root`
: {}.'
.
format
(
self
.
dataset_root
))
image_set_dir
=
os
.
path
.
join
(
self
.
dataset_root
,
'VOC2012'
,
'ImageSets'
,
...
...
@@ -76,7 +76,7 @@ class PascalVOC(Dataset):
if
not
os
.
path
.
exists
(
file_list_aug
):
raise
Exception
(
"When
mode
is 'trainaug', Pascal Voc dataset should be augmented, "
"When
`mode`
is 'trainaug', Pascal Voc dataset should be augmented, "
"Please make sure voc_augment.py has been properly run when using this mode."
)
...
...
dygraph/infer.py
浏览文件 @
727d93ad
...
...
@@ -88,7 +88,7 @@ def main(args):
else
fluid
.
CPUPlace
()
if
args
.
dataset
not
in
DATASETS
:
raise
Exception
(
'
--dataset
is invalid. it should be one of {}'
.
format
(
raise
Exception
(
'
`--dataset`
is invalid. it should be one of {}'
.
format
(
str
(
list
(
DATASETS
.
keys
()))))
dataset
=
DATASETS
[
args
.
dataset
]
...
...
@@ -101,7 +101,7 @@ def main(args):
if
args
.
model_name
not
in
MODELS
:
raise
Exception
(
'
--model_name
is invalid. it should be one of {}'
.
format
(
'
`--model_name`
is invalid. it should be one of {}'
.
format
(
str
(
list
(
MODELS
.
keys
()))))
model
=
MODELS
[
args
.
model_name
](
num_classes
=
test_dataset
.
num_classes
)
...
...
dygraph/train.py
浏览文件 @
727d93ad
...
...
@@ -13,21 +13,14 @@
# limitations under the License.
import
argparse
import
os
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph.parallel
import
ParallelEnv
from
paddle.fluid.io
import
DataLoader
from
paddle.incubate.hapi.distributed
import
DistributedBatchSampler
from
datasets
import
DATASETS
import
transforms
as
T
from
models
import
MODELS
import
utils.logging
as
logging
from
utils
import
get_environ_info
from
utils
import
load_pretrained_model
from
utils
import
resume
from
utils
import
Timer
,
calculate_eta
from
core
import
train
...
...
@@ -141,7 +134,7 @@ def main(args):
else
fluid
.
CPUPlace
()
if
args
.
dataset
not
in
DATASETS
:
raise
Exception
(
'
--dataset
is invalid. it should be one of {}'
.
format
(
raise
Exception
(
'
`--dataset`
is invalid. it should be one of {}'
.
format
(
str
(
list
(
DATASETS
.
keys
()))))
dataset
=
DATASETS
[
args
.
dataset
]
...
...
@@ -169,7 +162,7 @@ def main(args):
if
args
.
model_name
not
in
MODELS
:
raise
Exception
(
'
--model_name
is invalid. it should be one of {}'
.
format
(
'
`--model_name`
is invalid. it should be one of {}'
.
format
(
str
(
list
(
MODELS
.
keys
()))))
model
=
MODELS
[
args
.
model_name
](
num_classes
=
train_dataset
.
num_classes
)
...
...
dygraph/val.py
浏览文件 @
727d93ad
...
...
@@ -13,25 +13,14 @@
# limitations under the License.
import
argparse
import
os
import
math
import
numpy
as
np
import
tqdm
import
cv2
from
paddle.fluid.dygraph.base
import
to_variable
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph.parallel
import
ParallelEnv
from
paddle.fluid.io
import
DataLoader
from
paddle.fluid.dataloader
import
BatchSampler
from
datasets
import
DATASETS
import
transforms
as
T
from
models
import
MODELS
import
utils.logging
as
logging
from
utils
import
get_environ_info
from
utils
import
ConfusionMatrix
from
utils
import
Timer
,
calculate_eta
from
core
import
evaluate
...
...
@@ -87,7 +76,7 @@ def main(args):
else
fluid
.
CPUPlace
()
if
args
.
dataset
not
in
DATASETS
:
raise
Exception
(
'
--dataset
is invalid. it should be one of {}'
.
format
(
raise
Exception
(
'
`--dataset`
is invalid. it should be one of {}'
.
format
(
str
(
list
(
DATASETS
.
keys
()))))
dataset
=
DATASETS
[
args
.
dataset
]
...
...
@@ -100,7 +89,7 @@ def main(args):
if
args
.
model_name
not
in
MODELS
:
raise
Exception
(
'
--model_name
is invalid. it should be one of {}'
.
format
(
'
`--model_name`
is invalid. it should be one of {}'
.
format
(
str
(
list
(
MODELS
.
keys
()))))
model
=
MODELS
[
args
.
model_name
](
num_classes
=
eval_dataset
.
num_classes
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录