Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSeg
提交
60f24061
P
PaddleSeg
项目概览
PaddlePaddle
/
PaddleSeg
通知
289
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看板
提交
60f24061
编写于
8月 07, 2020
作者:
C
chenguowei01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ade20k dataset
上级
3643f1a6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
75 addition
and
2 deletion
+75
-2
dygraph/datasets/__init__.py
dygraph/datasets/__init__.py
+3
-1
dygraph/datasets/ade.py
dygraph/datasets/ade.py
+72
-0
dygraph/datasets/voc.py
dygraph/datasets/voc.py
+0
-1
未找到文件。
dygraph/datasets/__init__.py
浏览文件 @
60f24061
...
@@ -16,9 +16,11 @@ from .dataset import Dataset
...
@@ -16,9 +16,11 @@ from .dataset import Dataset
from
.optic_disc_seg
import
OpticDiscSeg
from
.optic_disc_seg
import
OpticDiscSeg
from
.cityscapes
import
Cityscapes
from
.cityscapes
import
Cityscapes
from
.voc
import
PascalVOC
from
.voc
import
PascalVOC
from
.ade
import
ADE20K
DATASETS
=
{
DATASETS
=
{
"OpticDiscSeg"
:
OpticDiscSeg
,
"OpticDiscSeg"
:
OpticDiscSeg
,
"Cityscapes"
:
Cityscapes
,
"Cityscapes"
:
Cityscapes
,
"PascalVOC"
:
PascalVOC
"PascalVOC"
:
PascalVOC
,
"ADE20K"
:
ADE20K
}
}
dygraph/datasets/ade.py
0 → 100644
浏览文件 @
60f24061
# Copyright (c) 2020 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.
import
os
from
.dataset
import
Dataset
from
utils.download
import
download_file_and_uncompress
DATA_HOME
=
os
.
path
.
expanduser
(
'~/.cache/paddle/dataset'
)
URL
=
"https://paddleseg.bj.bcebos.com/dataset/ADEChallengeData2016.zip"
class
ADE20K
(
Dataset
):
"""ADE20K dataset `http://sceneparsing.csail.mit.edu/`.
Args:
data_dir: 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 data_dir is None.
"""
def
__init__
(
self
,
data_dir
=
None
,
mode
=
'train'
,
transforms
=
None
,
download
=
True
):
self
.
data_dir
=
data_dir
self
.
transforms
=
transforms
self
.
mode
=
mode
self
.
file_list
=
list
()
self
.
num_classes
=
21
if
mode
.
lower
()
not
in
[
'train'
,
'val'
]:
raise
Exception
(
"mode should be one of ('train', 'val') in PascalVOC dataset, but got {}."
.
format
(
mode
))
if
self
.
transforms
is
None
:
raise
Exception
(
"transforms is necessary, but it is None."
)
if
self
.
data_dir
is
None
:
if
not
download
:
raise
Exception
(
"data_dir not set and auto download disabled."
)
self
.
data_dir
=
download_file_and_uncompress
(
url
=
URL
,
savepath
=
DATA_HOME
,
extrapath
=
DATA_HOME
,
extraname
=
'ADEChallengeData2016'
)
if
mode
==
'train'
:
img_dir
=
os
.
path
.
join
(
self
.
data_dir
,
'images/training'
)
grt_dir
=
os
.
path
.
join
(
self
.
data_dir
,
'annotations/training'
)
elif
mode
==
'val'
:
img_dir
=
os
.
path
.
join
(
self
.
data_dir
,
'images/validation'
)
grt_dir
=
os
.
path
.
join
(
self
.
data_dir
,
'annotations/validation'
)
img_files
=
os
.
listdir
(
img_dir
)
grt_files
=
[
i
.
replace
(
'.jpg'
,
'.png'
)
for
i
in
img_files
]
for
i
in
range
(
len
(
img_files
)):
img_path
=
os
.
path
.
join
(
img_dir
,
img_files
[
i
])
grt_path
=
os
.
path
.
join
(
grt_dir
,
grt_files
[
i
])
self
.
file_list
.
append
([
img_path
,
grt_path
])
dygraph/datasets/voc.py
浏览文件 @
60f24061
...
@@ -57,7 +57,6 @@ class PascalVOC(Dataset):
...
@@ -57,7 +57,6 @@ class PascalVOC(Dataset):
savepath
=
DATA_HOME
,
savepath
=
DATA_HOME
,
extrapath
=
DATA_HOME
,
extrapath
=
DATA_HOME
,
extraname
=
'VOCdevkit'
)
extraname
=
'VOCdevkit'
)
print
(
self
.
data_dir
)
image_set_dir
=
os
.
path
.
join
(
self
.
data_dir
,
'VOC2012'
,
'ImageSets'
,
image_set_dir
=
os
.
path
.
join
(
self
.
data_dir
,
'VOC2012'
,
'ImageSets'
,
'Segmentation'
)
'Segmentation'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录