Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleX
提交
5c4646d1
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看板
未验证
提交
5c4646d1
编写于
8月 10, 2020
作者:
J
Jason
提交者:
GitHub
8月 10, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #269 from biyuruofeng/paddlex-gu
格式转换中的几个错误
上级
dd323e8d
a3c36b82
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
7 addition
and
6 deletion
+7
-6
paddlex/tools/x2coco.py
paddlex/tools/x2coco.py
+3
-3
paddlex/tools/x2seg.py
paddlex/tools/x2seg.py
+4
-3
未找到文件。
paddlex/tools/x2coco.py
浏览文件 @
5c4646d1
...
@@ -147,7 +147,7 @@ class LabelMe2COCO(X2COCO):
...
@@ -147,7 +147,7 @@ class LabelMe2COCO(X2COCO):
img_name_part
=
osp
.
splitext
(
img_file
)[
0
]
img_name_part
=
osp
.
splitext
(
img_file
)[
0
]
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
if
not
osp
.
exists
(
json_file
):
if
not
osp
.
exists
(
json_file
):
os
.
remove
(
osp
.
join
(
im
age
_dir
,
img_file
))
os
.
remove
(
osp
.
join
(
im
g
_dir
,
img_file
))
continue
continue
image_id
=
image_id
+
1
image_id
=
image_id
+
1
with
open
(
json_file
,
mode
=
'r'
,
\
with
open
(
json_file
,
mode
=
'r'
,
\
...
@@ -220,7 +220,7 @@ class EasyData2COCO(X2COCO):
...
@@ -220,7 +220,7 @@ class EasyData2COCO(X2COCO):
img_name_part
=
osp
.
splitext
(
img_file
)[
0
]
img_name_part
=
osp
.
splitext
(
img_file
)[
0
]
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
if
not
osp
.
exists
(
json_file
):
if
not
osp
.
exists
(
json_file
):
os
.
remove
(
osp
.
join
(
im
age
_dir
,
img_file
))
os
.
remove
(
osp
.
join
(
im
g
_dir
,
img_file
))
continue
continue
image_id
=
image_id
+
1
image_id
=
image_id
+
1
with
open
(
json_file
,
mode
=
'r'
,
\
with
open
(
json_file
,
mode
=
'r'
,
\
...
@@ -317,7 +317,7 @@ class JingLing2COCO(X2COCO):
...
@@ -317,7 +317,7 @@ class JingLing2COCO(X2COCO):
img_name_part
=
osp
.
splitext
(
img_file
)[
0
]
img_name_part
=
osp
.
splitext
(
img_file
)[
0
]
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
if
not
osp
.
exists
(
json_file
):
if
not
osp
.
exists
(
json_file
):
os
.
remove
(
osp
.
join
(
im
age
_dir
,
img_file
))
os
.
remove
(
osp
.
join
(
im
g
_dir
,
img_file
))
continue
continue
image_id
=
image_id
+
1
image_id
=
image_id
+
1
with
open
(
json_file
,
mode
=
'r'
,
\
with
open
(
json_file
,
mode
=
'r'
,
\
...
...
paddlex/tools/x2seg.py
浏览文件 @
5c4646d1
...
@@ -23,6 +23,7 @@ import shutil
...
@@ -23,6 +23,7 @@ import shutil
import
numpy
as
np
import
numpy
as
np
import
PIL.Image
import
PIL.Image
from
.base
import
MyEncoder
,
is_pic
,
get_encoding
from
.base
import
MyEncoder
,
is_pic
,
get_encoding
import
math
class
X2Seg
(
object
):
class
X2Seg
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -140,7 +141,7 @@ class JingLing2Seg(X2Seg):
...
@@ -140,7 +141,7 @@ class JingLing2Seg(X2Seg):
img_name_part
=
osp
.
splitext
(
img_name
)[
0
]
img_name_part
=
osp
.
splitext
(
img_name
)[
0
]
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
if
not
osp
.
exists
(
json_file
):
if
not
osp
.
exists
(
json_file
):
os
.
remove
(
os
.
remove
(
osp
.
join
(
image_dir
,
img_name
)
))
os
.
remove
(
os
p
.
join
(
image_dir
,
img_name
))
continue
continue
with
open
(
json_file
,
mode
=
"r"
,
\
with
open
(
json_file
,
mode
=
"r"
,
\
encoding
=
get_encoding
(
json_file
))
as
j
:
encoding
=
get_encoding
(
json_file
))
as
j
:
...
@@ -226,7 +227,7 @@ class LabelMe2Seg(X2Seg):
...
@@ -226,7 +227,7 @@ class LabelMe2Seg(X2Seg):
img_name_part
=
osp
.
splitext
(
img_name
)[
0
]
img_name_part
=
osp
.
splitext
(
img_name
)[
0
]
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
if
not
osp
.
exists
(
json_file
):
if
not
osp
.
exists
(
json_file
):
os
.
remove
(
os
.
remove
(
osp
.
join
(
image_dir
,
img_name
)
))
os
.
remove
(
os
p
.
join
(
image_dir
,
img_name
))
continue
continue
img_file
=
osp
.
join
(
image_dir
,
img_name
)
img_file
=
osp
.
join
(
image_dir
,
img_name
)
img
=
np
.
asarray
(
PIL
.
Image
.
open
(
img_file
))
img
=
np
.
asarray
(
PIL
.
Image
.
open
(
img_file
))
...
@@ -260,7 +261,7 @@ class EasyData2Seg(X2Seg):
...
@@ -260,7 +261,7 @@ class EasyData2Seg(X2Seg):
img_name_part
=
osp
.
splitext
(
img_name
)[
0
]
img_name_part
=
osp
.
splitext
(
img_name
)[
0
]
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
json_file
=
osp
.
join
(
json_dir
,
img_name_part
+
".json"
)
if
not
osp
.
exists
(
json_file
):
if
not
osp
.
exists
(
json_file
):
os
.
remove
(
os
.
remove
(
osp
.
join
(
image_dir
,
img_name
)
))
os
.
remove
(
os
p
.
join
(
image_dir
,
img_name
))
continue
continue
with
open
(
json_file
,
mode
=
"r"
,
\
with
open
(
json_file
,
mode
=
"r"
,
\
encoding
=
get_encoding
(
json_file
))
as
j
:
encoding
=
get_encoding
(
json_file
))
as
j
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录