Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
1ba879be
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看板
提交
1ba879be
编写于
7月 12, 2017
作者:
W
wanghaoshuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use PIL to read image in palette mode
上级
c4f301de
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
4 deletion
+8
-4
python/paddle/v2/dataset/tests/vocseg_test.py
python/paddle/v2/dataset/tests/vocseg_test.py
+1
-1
python/paddle/v2/dataset/voc_seg.py
python/paddle/v2/dataset/voc_seg.py
+7
-3
未找到文件。
python/paddle/v2/dataset/tests/vocseg_test.py
浏览文件 @
1ba879be
...
@@ -21,7 +21,7 @@ class TestVOC(unittest.TestCase):
...
@@ -21,7 +21,7 @@ class TestVOC(unittest.TestCase):
sum
=
0
sum
=
0
label
=
0
label
=
0
for
l
in
reader
():
for
l
in
reader
():
self
.
assertEqual
(
l
[
0
].
size
,
l
[
1
].
size
)
self
.
assertEqual
(
l
[
0
].
size
,
3
*
l
[
1
].
size
)
sum
+=
1
sum
+=
1
return
sum
return
sum
...
...
python/paddle/v2/dataset/voc_seg.py
浏览文件 @
1ba879be
...
@@ -20,14 +20,16 @@ with segmentation has been increased from 7,062 to 9,993.
...
@@ -20,14 +20,16 @@ with segmentation has been increased from 7,062 to 9,993.
"""
"""
import
tarfile
import
tarfile
import
io
import
numpy
as
np
import
numpy
as
np
from
common
import
download
from
common
import
download
from
paddle.v2.image
import
*
from
paddle.v2.image
import
*
from
PIL
import
Image
__all__
=
[
'train'
,
'test'
,
'val'
]
__all__
=
[
'train'
,
'test'
,
'val'
]
VOC_URL
=
'http://host.robots.ox.ac.uk/pascal/VOC/voc2012/
\
VOC_URL
=
'http://host.robots.ox.ac.uk/pascal/VOC/voc2012/
\
VOCtrainval_11-May-2012.tar'
VOCtrainval_11-May-2012.tar'
VOC_MD5
=
'6cd6e144f989b92b3379bac3b3de84fd'
VOC_MD5
=
'6cd6e144f989b92b3379bac3b3de84fd'
SET_FILE
=
'VOCdevkit/VOC2012/ImageSets/Segmentation/{}.txt'
SET_FILE
=
'VOCdevkit/VOC2012/ImageSets/Segmentation/{}.txt'
...
@@ -51,8 +53,10 @@ def reader_creator(filename, sub_name):
...
@@ -51,8 +53,10 @@ def reader_creator(filename, sub_name):
label_file
=
LABEL_FILE
.
format
(
line
)
label_file
=
LABEL_FILE
.
format
(
line
)
data
=
tarobject
.
extractfile
(
name2mem
[
data_file
]).
read
()
data
=
tarobject
.
extractfile
(
name2mem
[
data_file
]).
read
()
label
=
tarobject
.
extractfile
(
name2mem
[
label_file
]).
read
()
label
=
tarobject
.
extractfile
(
name2mem
[
label_file
]).
read
()
data
=
load_image_bytes
(
data
)
data
=
Image
.
open
(
io
.
BytesIO
(
data
))
label
=
load_image_bytes
(
label
)
label
=
Image
.
open
(
io
.
BytesIO
(
label
))
data
=
np
.
array
(
data
)
label
=
np
.
array
(
label
)
yield
data
,
label
yield
data
,
label
return
reader
return
reader
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录