Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleX
提交
971dcbd8
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
971dcbd8
编写于
7月 17, 2020
作者:
J
Jason
提交者:
GitHub
7月 17, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #232 from SunAhong1993/develop
modify the labelme2coco.py
上级
c5529a5c
b59974f7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
8 addition
and
7 deletion
+8
-7
docs/data/annotation.md
docs/data/annotation.md
+3
-1
paddlex/tools/x2coco.py
paddlex/tools/x2coco.py
+5
-6
未找到文件。
docs/data/annotation.md
浏览文件 @
971dcbd8
...
@@ -36,4 +36,6 @@ paddlex --data_conversion --source labelme --to PascalVOC --pics ./pics --annota
...
@@ -36,4 +36,6 @@ paddlex --data_conversion --source labelme --to PascalVOC --pics ./pics --annota
| --pics | 指定原图所在的目录路径 |
| --pics | 指定原图所在的目录路径 |
| --annotations | 指定标注文件所在的目录路径 |
| --annotations | 指定标注文件所在的目录路径 |
**注意**
:精灵标注的目标检测数据可以在工具内部导出为PascalVOC格式,因此paddlex未提供精灵标注数据到PascalVOC格式的转换
**注意**
:
1.
精灵标注的目标检测数据可以在工具内部导出为PascalVOC格式,因此paddlex未提供精灵标注数据到PascalVOC格式的转换
2.
在将LabelMe数据集转换为COCO数据集时,LabelMe的图像文件名和json文件名需要一一对应,才可正确转换
paddlex/tools/x2coco.py
浏览文件 @
971dcbd8
...
@@ -96,12 +96,13 @@ class LabelMe2COCO(X2COCO):
...
@@ -96,12 +96,13 @@ class LabelMe2COCO(X2COCO):
def
__init__
(
self
):
def
__init__
(
self
):
super
(
LabelMe2COCO
,
self
).
__init__
()
super
(
LabelMe2COCO
,
self
).
__init__
()
def
generate_images_field
(
self
,
json_info
,
image_id
):
def
generate_images_field
(
self
,
json_info
,
image_
file
,
image_
id
):
image
=
{}
image
=
{}
image
[
"height"
]
=
json_info
[
"imageHeight"
]
image
[
"height"
]
=
json_info
[
"imageHeight"
]
image
[
"width"
]
=
json_info
[
"imageWidth"
]
image
[
"width"
]
=
json_info
[
"imageWidth"
]
image
[
"id"
]
=
image_id
+
1
image
[
"id"
]
=
image_id
+
1
json_info
[
"imagePath"
]
=
path_normalization
(
json_info
[
"imagePath"
])
json_img_path
=
path_normalization
(
json_info
[
"imagePath"
])
json_info
[
"imagePath"
]
=
osp
.
join
(
osp
.
split
(
json_img_path
)[
0
],
image_file
)
image
[
"file_name"
]
=
osp
.
split
(
json_info
[
"imagePath"
])[
-
1
]
image
[
"file_name"
]
=
osp
.
split
(
json_info
[
"imagePath"
])[
-
1
]
return
image
return
image
...
@@ -152,7 +153,7 @@ class LabelMe2COCO(X2COCO):
...
@@ -152,7 +153,7 @@ class LabelMe2COCO(X2COCO):
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
:
json_info
=
json
.
load
(
j
)
json_info
=
json
.
load
(
j
)
img_info
=
self
.
generate_images_field
(
json_info
,
image_id
)
img_info
=
self
.
generate_images_field
(
json_info
,
im
g_file
,
im
age_id
)
self
.
images_list
.
append
(
img_info
)
self
.
images_list
.
append
(
img_info
)
for
shapes
in
json_info
[
"shapes"
]:
for
shapes
in
json_info
[
"shapes"
]:
object_id
=
object_id
+
1
object_id
=
object_id
+
1
...
@@ -361,5 +362,3 @@ class JingLing2COCO(X2COCO):
...
@@ -361,5 +362,3 @@ class JingLing2COCO(X2COCO):
self
.
annotations_list
.
append
(
self
.
annotations_list
.
append
(
self
.
generate_rectangle_anns_field
(
points
,
label
,
image_id
,
self
.
generate_rectangle_anns_field
(
points
,
label
,
image_id
,
object_id
,
label_to_num
))
object_id
,
label_to_num
))
\ No newline at end of file
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录