Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleX
提交
3f816875
P
PaddleX
项目概览
PaddlePaddle
/
PaddleX
通知
138
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
43
列表
看板
标记
里程碑
合并请求
5
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
43
Issue
43
列表
看板
标记
里程碑
合并请求
5
合并请求
5
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3f816875
编写于
7月 10, 2020
作者:
S
SunAhong1993
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add dataset path chaeck
上级
a3465454
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
76 addition
and
3 deletion
+76
-3
paddlex/cv/datasets/__pycache__/__init__.cpython-37.pyc
paddlex/cv/datasets/__pycache__/__init__.cpython-37.pyc
+0
-0
paddlex/cv/datasets/__pycache__/coco.cpython-37.pyc
paddlex/cv/datasets/__pycache__/coco.cpython-37.pyc
+0
-0
paddlex/cv/datasets/__pycache__/dataset.cpython-37.pyc
paddlex/cv/datasets/__pycache__/dataset.cpython-37.pyc
+0
-0
paddlex/cv/datasets/__pycache__/easydata_cls.cpython-37.pyc
paddlex/cv/datasets/__pycache__/easydata_cls.cpython-37.pyc
+0
-0
paddlex/cv/datasets/__pycache__/easydata_det.cpython-37.pyc
paddlex/cv/datasets/__pycache__/easydata_det.cpython-37.pyc
+0
-0
paddlex/cv/datasets/__pycache__/easydata_seg.cpython-37.pyc
paddlex/cv/datasets/__pycache__/easydata_seg.cpython-37.pyc
+0
-0
paddlex/cv/datasets/__pycache__/imagenet.cpython-37.pyc
paddlex/cv/datasets/__pycache__/imagenet.cpython-37.pyc
+0
-0
paddlex/cv/datasets/__pycache__/seg_dataset.cpython-37.pyc
paddlex/cv/datasets/__pycache__/seg_dataset.cpython-37.pyc
+0
-0
paddlex/cv/datasets/__pycache__/voc.cpython-37.pyc
paddlex/cv/datasets/__pycache__/voc.cpython-37.pyc
+0
-0
paddlex/cv/datasets/dataset.py
paddlex/cv/datasets/dataset.py
+1
-0
paddlex/cv/datasets/easydata_cls.py
paddlex/cv/datasets/easydata_cls.py
+9
-0
paddlex/cv/datasets/easydata_det.py
paddlex/cv/datasets/easydata_det.py
+9
-0
paddlex/cv/datasets/easydata_seg.py
paddlex/cv/datasets/easydata_seg.py
+9
-0
paddlex/cv/datasets/imagenet.py
paddlex/cv/datasets/imagenet.py
+7
-0
paddlex/cv/datasets/seg_dataset.py
paddlex/cv/datasets/seg_dataset.py
+8
-1
paddlex/cv/datasets/shared_queue/__pycache__/__init__.cpython-37.pyc
...datasets/shared_queue/__pycache__/__init__.cpython-37.pyc
+0
-0
paddlex/cv/datasets/shared_queue/__pycache__/queue.cpython-37.pyc
...cv/datasets/shared_queue/__pycache__/queue.cpython-37.pyc
+0
-0
paddlex/cv/datasets/shared_queue/__pycache__/sharedmemory.cpython-37.pyc
...sets/shared_queue/__pycache__/sharedmemory.cpython-37.pyc
+0
-0
paddlex/cv/datasets/voc.py
paddlex/cv/datasets/voc.py
+14
-2
paddlex/tools/x2coco.py
paddlex/tools/x2coco.py
+19
-0
未找到文件。
paddlex/cv/datasets/__pycache__/__init__.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/__pycache__/coco.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/__pycache__/dataset.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/__pycache__/easydata_cls.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/__pycache__/easydata_det.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/__pycache__/easydata_seg.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/__pycache__/imagenet.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/__pycache__/seg_dataset.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/__pycache__/voc.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/dataset.py
浏览文件 @
3f816875
...
...
@@ -55,6 +55,7 @@ def get_encoding(path):
f
=
open
(
path
,
'rb'
)
data
=
f
.
read
()
file_encoding
=
chardet
.
detect
(
data
).
get
(
'encoding'
)
f
.
close
()
return
file_encoding
...
...
paddlex/cv/datasets/easydata_cls.py
浏览文件 @
3f816875
...
...
@@ -14,6 +14,7 @@
from
__future__
import
absolute_import
import
os.path
as
osp
import
platform
import
random
import
copy
import
json
...
...
@@ -64,10 +65,18 @@ class EasyDataCls(ImageNet):
item
=
line
.
strip
()
self
.
labels
.
append
(
item
)
logging
.
info
(
"Starting to read file list from dataset..."
)
win_sep
=
"
\\
"
other_sep
=
"/"
with
open
(
file_list
,
encoding
=
get_encoding
(
file_list
))
as
f
:
for
line
in
f
:
img_file
,
json_file
=
[
osp
.
join
(
data_dir
,
x
)
\
for
x
in
line
.
strip
().
split
()[:
2
]]
if
platform
.
system
()
==
"Windows"
:
img_file
=
win_sep
.
join
(
img_file
.
split
(
other_sep
))
json_file
=
win_sep
.
join
(
json_file
.
split
(
other_sep
))
else
:
img_file
=
other_sep
.
join
(
img_file
.
split
(
win_sep
))
json_file
=
other_sep
.
join
(
json_file
.
split
(
win_sep
))
if
not
is_pic
(
img_file
):
continue
if
not
osp
.
isfile
(
json_file
):
...
...
paddlex/cv/datasets/easydata_det.py
浏览文件 @
3f816875
...
...
@@ -14,6 +14,7 @@
from
__future__
import
absolute_import
import
os.path
as
osp
import
platform
import
random
import
copy
import
json
...
...
@@ -83,10 +84,18 @@ class EasyDataDet(VOCDetection):
from
pycocotools.mask
import
decode
ct
=
0
ann_ct
=
0
win_sep
=
"
\\
"
other_sep
=
"/"
with
open
(
file_list
,
encoding
=
get_encoding
(
file_list
))
as
f
:
for
line
in
f
:
img_file
,
json_file
=
[
osp
.
join
(
data_dir
,
x
)
\
for
x
in
line
.
strip
().
split
()[:
2
]]
if
platform
.
system
()
==
"Windows"
:
img_file
=
win_sep
.
join
(
img_file
.
split
(
other_sep
))
json_file
=
win_sep
.
join
(
json_file
.
split
(
other_sep
))
else
:
img_file
=
other_sep
.
join
(
img_file
.
split
(
win_sep
))
json_file
=
other_sep
.
join
(
json_file
.
split
(
win_sep
))
if
not
is_pic
(
img_file
):
continue
if
not
osp
.
isfile
(
json_file
):
...
...
paddlex/cv/datasets/easydata_seg.py
浏览文件 @
3f816875
...
...
@@ -14,6 +14,7 @@
from
__future__
import
absolute_import
import
os.path
as
osp
import
platform
import
random
import
copy
import
json
...
...
@@ -61,6 +62,8 @@ class EasyDataSeg(Dataset):
from
pycocotools.mask
import
decode
cname2cid
=
{}
label_id
=
0
win_sep
=
"
\\
"
other_sep
=
"/"
with
open
(
label_list
,
encoding
=
get_encoding
(
label_list
))
as
fr
:
for
line
in
fr
.
readlines
():
cname2cid
[
line
.
strip
()]
=
label_id
...
...
@@ -71,6 +74,12 @@ class EasyDataSeg(Dataset):
for
line
in
f
:
img_file
,
json_file
=
[
osp
.
join
(
data_dir
,
x
)
\
for
x
in
line
.
strip
().
split
()[:
2
]]
if
platform
.
system
()
==
"Windows"
:
img_file
=
win_sep
.
join
(
img_file
.
split
(
other_sep
))
json_file
=
win_sep
.
join
(
json_file
.
split
(
other_sep
))
else
:
img_file
=
other_sep
.
join
(
img_file
.
split
(
win_sep
))
json_file
=
other_sep
.
join
(
json_file
.
split
(
win_sep
))
if
not
is_pic
(
img_file
):
continue
if
not
osp
.
isfile
(
json_file
):
...
...
paddlex/cv/datasets/imagenet.py
浏览文件 @
3f816875
...
...
@@ -14,6 +14,7 @@
from
__future__
import
absolute_import
import
os.path
as
osp
import
platform
import
random
import
copy
import
paddlex.utils.logging
as
logging
...
...
@@ -63,9 +64,15 @@ class ImageNet(Dataset):
item
=
line
.
strip
()
self
.
labels
.
append
(
item
)
logging
.
info
(
"Starting to read file list from dataset..."
)
win_sep
=
"
\\
"
other_sep
=
"/"
with
open
(
file_list
,
encoding
=
get_encoding
(
file_list
))
as
f
:
for
line
in
f
:
items
=
line
.
strip
().
split
()
if
platform
.
system
()
==
"Windows"
:
items
[
0
]
=
win_sep
.
join
(
items
[
0
].
split
(
other_sep
))
else
:
items
[
0
]
=
other_sep
.
join
(
items
[
0
].
split
(
win_sep
))
if
not
is_pic
(
items
[
0
]):
continue
full_path
=
osp
.
join
(
data_dir
,
items
[
0
])
...
...
paddlex/cv/datasets/seg_dataset.py
浏览文件 @
3f816875
...
...
@@ -61,10 +61,17 @@ class SegDataset(Dataset):
for
line
in
f
:
item
=
line
.
strip
()
self
.
labels
.
append
(
item
)
win_sep
=
"
\\
"
other_sep
=
"/"
with
open
(
file_list
,
encoding
=
get_encoding
(
file_list
))
as
f
:
for
line
in
f
:
items
=
line
.
strip
().
split
()
if
platform
.
system
()
==
"Windows"
:
items
[
0
]
=
win_sep
.
join
(
items
[
0
].
split
(
other_sep
))
items
[
1
]
=
win_sep
.
join
(
items
[
1
].
split
(
other_sep
))
else
:
items
[
0
]
=
other_sep
.
join
(
items
[
0
].
split
(
win_sep
))
items
[
1
]
=
other_sep
.
join
(
items
[
1
].
split
(
win_sep
))
if
not
is_pic
(
items
[
0
]):
continue
full_path_im
=
osp
.
join
(
data_dir
,
items
[
0
])
...
...
paddlex/cv/datasets/shared_queue/__pycache__/__init__.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/shared_queue/__pycache__/queue.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/shared_queue/__pycache__/sharedmemory.cpython-37.pyc
0 → 100644
浏览文件 @
3f816875
文件已添加
paddlex/cv/datasets/voc.py
浏览文件 @
3f816875
...
...
@@ -16,6 +16,7 @@ from __future__ import absolute_import
import
copy
import
os
import
os.path
as
osp
import
platform
import
random
import
re
import
numpy
as
np
...
...
@@ -85,6 +86,8 @@ class VOCDetection(Dataset):
})
ct
=
0
ann_ct
=
0
win_sep
=
"
\\
"
other_sep
=
"/"
with
open
(
file_list
,
'r'
,
encoding
=
get_encoding
(
file_list
))
as
fr
:
while
True
:
line
=
fr
.
readline
()
...
...
@@ -92,6 +95,12 @@ class VOCDetection(Dataset):
break
img_file
,
xml_file
=
[
osp
.
join
(
data_dir
,
x
)
\
for
x
in
line
.
strip
().
split
()[:
2
]]
if
platform
.
system
()
==
"Windows"
:
img_file
=
win_sep
.
join
(
img_file
.
split
(
other_sep
))
xml_file
=
win_sep
.
join
(
xml_file
.
split
(
other_sep
))
else
:
img_file
=
other_sep
.
join
(
img_file
.
split
(
win_sep
))
xml_file
=
other_sep
.
join
(
xml_file
.
split
(
win_sep
))
if
not
is_pic
(
img_file
):
continue
if
not
osp
.
isfile
(
xml_file
):
...
...
@@ -106,8 +115,11 @@ class VOCDetection(Dataset):
ct
=
int
(
tree
.
find
(
'id'
).
text
)
im_id
=
np
.
array
([
int
(
tree
.
find
(
'id'
).
text
)])
pattern
=
re
.
compile
(
'<object>'
,
re
.
IGNORECASE
)
obj_tag
=
pattern
.
findall
(
str
(
ET
.
tostringlist
(
tree
.
getroot
())))[
0
][
1
:
-
1
]
obj_match
=
pattern
.
findall
(
str
(
ET
.
tostringlist
(
tree
.
getroot
())))
if
len
(
obj_match
)
==
0
:
continue
obj_tag
=
obj_match
[
0
][
1
:
-
1
]
objs
=
tree
.
findall
(
obj_tag
)
pattern
=
re
.
compile
(
'<size>'
,
re
.
IGNORECASE
)
size_tag
=
pattern
.
findall
(
...
...
paddlex/tools/x2coco.py
浏览文件 @
3f816875
...
...
@@ -18,6 +18,7 @@ import cv2
import
json
import
os
import
os.path
as
osp
import
platform
import
shutil
import
numpy
as
np
import
PIL.ImageDraw
...
...
@@ -100,6 +101,12 @@ class LabelMe2COCO(X2COCO):
image
[
"height"
]
=
json_info
[
"imageHeight"
]
image
[
"width"
]
=
json_info
[
"imageWidth"
]
image
[
"id"
]
=
image_id
+
1
win_sep
=
"
\\
"
other_sep
=
"/"
if
platform
.
system
()
==
"Windows"
:
json_info
[
"imagePath"
]
=
win_sep
.
join
(
json_info
[
"imagePath"
].
split
(
other_sep
))
else
:
json_info
[
"imagePath"
]
=
other_sep
.
join
(
json_info
[
"imagePath"
].
split
(
win_sep
))
image
[
"file_name"
]
=
osp
.
split
(
json_info
[
"imagePath"
])[
-
1
]
return
image
...
...
@@ -187,6 +194,12 @@ class EasyData2COCO(X2COCO):
image
[
"height"
]
=
img
.
shape
[
0
]
image
[
"width"
]
=
img
.
shape
[
1
]
image
[
"id"
]
=
image_id
+
1
win_sep
=
"
\\
"
other_sep
=
"/"
if
platform
.
system
()
==
"Windows"
:
img_path
=
win_sep
.
join
(
img_path
.
split
(
other_sep
))
else
:
img_path
=
other_sep
.
join
(
img_path
.
split
(
win_sep
))
image
[
"file_name"
]
=
osp
.
split
(
img_path
)[
-
1
]
return
image
...
...
@@ -268,6 +281,12 @@ class JingLing2COCO(X2COCO):
image
[
"height"
]
=
json_info
[
"size"
][
"height"
]
image
[
"width"
]
=
json_info
[
"size"
][
"width"
]
image
[
"id"
]
=
image_id
+
1
win_sep
=
"
\\
"
other_sep
=
"/"
if
platform
.
system
()
==
"Windows"
:
json_info
[
"path"
]
=
win_sep
.
join
(
json_info
[
"path"
].
split
(
other_sep
))
else
:
json_info
[
"path"
]
=
other_sep
.
join
(
json_info
[
"path"
].
split
(
win_sep
))
image
[
"file_name"
]
=
osp
.
split
(
json_info
[
"path"
])[
-
1
]
return
image
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录