Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
不会修仙的道士
labelme
提交
9a191df9
L
labelme
项目概览
不会修仙的道士
/
labelme
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
labelme
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9a191df9
编写于
1月 26, 2020
作者:
K
Kentaro Wada
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Colorize shapes according to uniqLabelList
上级
3936c550
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
28 deletion
+53
-28
examples/instance_segmentation/data_annotated/2011_000025.json
...les/instance_segmentation/data_annotated/2011_000025.json
+21
-14
labelme/app.py
labelme/app.py
+23
-5
labelme/shape.py
labelme/shape.py
+9
-9
未找到文件。
examples/instance_segmentation/data_annotated/2011_000025.json
浏览文件 @
9a191df9
{
"imageData"
:
null
,
"version"
:
"3.22.0"
,
"flags"
:
{},
"shapes"
:
[
{
"fill_color"
:
null
,
"line_color"
:
null
,
"label"
:
"bus-1"
,
"label"
:
"bus"
,
"points"
:
[
[
260.936170212766
,
...
...
@@ -114,12 +113,13 @@
338.936170212766
,
25.563829787234056
]
]
],
"group_id"
:
null
,
"shape_type"
:
"polygon"
,
"flags"
:
{}
},
{
"fill_color"
:
null
,
"line_color"
:
null
,
"label"
:
"bus-2"
,
"label"
:
"bus"
,
"points"
:
[
[
88.93617021276599
,
...
...
@@ -165,11 +165,12 @@
81.93617021276599
,
151.56382978723406
]
]
],
"group_id"
:
null
,
"shape_type"
:
"polygon"
,
"flags"
:
{}
},
{
"fill_color"
:
null
,
"line_color"
:
null
,
"label"
:
"car"
,
"points"
:
[
[
...
...
@@ -196,9 +197,16 @@
408.936170212766
,
218.56382978723406
]
]
],
"group_id"
:
null
,
"shape_type"
:
"polygon"
,
"flags"
:
{}
}
],
"imagePath"
:
"2011_000025.jpg"
,
"imageData"
:
null
,
"imageHeight"
:
375
,
"imageWidth"
:
500
,
"fillColor"
:
[
255
,
0
,
...
...
@@ -210,6 +218,5 @@
255
,
0
,
128
],
"imagePath"
:
"2011_000025.jpg"
]
}
\ No newline at end of file
labelme/app.py
浏览文件 @
9a191df9
...
...
@@ -4,6 +4,7 @@ import os.path as osp
import
re
import
webbrowser
import
imgviz
from
qtpy
import
QtCore
from
qtpy.QtCore
import
Qt
from
qtpy
import
QtGui
...
...
@@ -39,6 +40,9 @@ from labelme.widgets import ZoomWidget
# - Zoom is too "steppy".
LABEL_COLORMAP
=
imgviz
.
label_colormap
()
class
MainWindow
(
QtWidgets
.
QMainWindow
):
FIT_WINDOW
,
FIT_WIDTH
,
MANUAL_ZOOM
=
0
,
1
,
2
...
...
@@ -115,7 +119,6 @@ class MainWindow(QtWidgets.QMainWindow):
"Press 'Esc' to deselect."
))
if
self
.
_config
[
'labels'
]:
self
.
uniqLabelList
.
addItems
(
self
.
_config
[
'labels'
])
self
.
uniqLabelList
.
sortItems
()
self
.
label_dock
=
QtWidgets
.
QDockWidget
(
self
.
tr
(
u
'Label List'
),
self
)
self
.
label_dock
.
setObjectName
(
u
'Label List'
)
self
.
label_dock
.
setWidget
(
self
.
uniqLabelList
)
...
...
@@ -918,7 +921,6 @@ class MainWindow(QtWidgets.QMainWindow):
self
.
setDirty
()
if
not
self
.
uniqLabelList
.
findItems
(
shape
.
label
,
Qt
.
MatchExactly
):
self
.
uniqLabelList
.
addItem
(
shape
.
label
)
self
.
uniqLabelList
.
sortItems
()
def
fileSearchChanged
(
self
):
self
.
importDirImages
(
...
...
@@ -972,11 +974,23 @@ class MainWindow(QtWidgets.QMainWindow):
self
.
labelList
.
addItem
(
item
)
if
not
self
.
uniqLabelList
.
findItems
(
shape
.
label
,
Qt
.
MatchExactly
):
self
.
uniqLabelList
.
addItem
(
shape
.
label
)
self
.
uniqLabelList
.
sortItems
()
self
.
labelDialog
.
addLabelHistory
(
shape
.
label
)
for
action
in
self
.
actions
.
onShapesPresent
:
action
.
setEnabled
(
True
)
r
,
g
,
b
=
self
.
_get_rgb_by_label
(
shape
.
label
)
shape
.
line_color
=
QtGui
.
QColor
(
r
,
g
,
b
)
shape
.
vertex_fill_color
=
QtGui
.
QColor
(
r
,
g
,
b
)
shape
.
hvertex_fill_color
=
QtGui
.
QColor
(
255
,
255
,
255
)
shape
.
fill_color
=
QtGui
.
QColor
(
r
,
g
,
b
,
127
)
shape
.
select_line_color
=
QtGui
.
QColor
(
255
,
255
,
255
)
shape
.
select_fill_color
=
QtGui
.
QColor
(
r
,
g
,
b
,
155
)
def
_get_rgb_by_label
(
self
,
label
):
item
=
self
.
uniqLabelList
.
findItems
(
label
,
Qt
.
MatchExactly
)[
0
]
label_id
=
self
.
uniqLabelList
.
indexFromItem
(
item
).
row
()
-
1
return
LABEL_COLORMAP
[
label_id
%
len
(
LABEL_COLORMAP
)]
def
remLabels
(
self
,
shapes
):
for
shape
in
shapes
:
item
=
self
.
labelList
.
get_item_from_shape
(
shape
)
...
...
@@ -1000,7 +1014,9 @@ class MainWindow(QtWidgets.QMainWindow):
group_id
=
shape
.
get
(
'group_id'
)
shape
=
Shape
(
label
=
label
,
shape_type
=
shape_type
,
group_id
=
group_id
label
=
label
,
shape_type
=
shape_type
,
group_id
=
group_id
,
)
for
x
,
y
in
points
:
shape
.
addPoint
(
QtCore
.
QPointF
(
x
,
y
))
...
...
@@ -1113,6 +1129,7 @@ class MainWindow(QtWidgets.QMainWindow):
items
=
self
.
uniqLabelList
.
selectedItems
()
text
=
None
flags
=
{}
group_id
=
None
if
items
:
text
=
items
[
0
].
text
()
if
self
.
_config
[
'display_label_popup'
]
or
not
text
:
...
...
@@ -1127,7 +1144,7 @@ class MainWindow(QtWidgets.QMainWindow):
instance_text
=
previous_label
if
instance_text
!=
''
:
text
=
instance_text
text
,
flags
=
self
.
labelDialog
.
popUp
(
text
)
text
,
flags
,
group_id
=
self
.
labelDialog
.
popUp
(
text
)
if
text
is
None
:
self
.
labelDialog
.
edit
.
setText
(
previous_label
)
...
...
@@ -1142,6 +1159,7 @@ class MainWindow(QtWidgets.QMainWindow):
if
text
:
self
.
labelList
.
clearSelection
()
shape
=
self
.
canvas
.
setLastLabel
(
text
,
flags
)
shape
.
group_id
=
group_id
self
.
addLabel
(
shape
)
self
.
actions
.
editMode
.
setEnabled
(
True
)
self
.
actions
.
undoLastPoint
.
setEnabled
(
False
)
...
...
labelme/shape.py
浏览文件 @
9a191df9
...
...
@@ -11,12 +11,12 @@ import labelme.utils
# - [opt] Store paths instead of creating new ones at each paint.
DEFAULT_LINE_COLOR
=
QtGui
.
QColor
(
0
,
255
,
0
,
128
)
DEFAULT_FILL_COLOR
=
QtGui
.
QColor
(
255
,
0
,
0
,
128
)
DEFAULT_SELECT_LINE_COLOR
=
QtGui
.
QColor
(
255
,
255
,
255
)
DEFAULT_SELECT_FILL_COLOR
=
QtGui
.
QColor
(
0
,
128
,
255
,
155
)
DEFAULT_VERTEX_FILL_COLOR
=
QtGui
.
QColor
(
0
,
255
,
0
,
255
)
DEFAULT_HVERTEX_FILL_COLOR
=
QtGui
.
QColor
(
255
,
0
,
0
)
DEFAULT_LINE_COLOR
=
QtGui
.
QColor
(
0
,
255
,
0
,
128
)
# before hovering
DEFAULT_FILL_COLOR
=
QtGui
.
QColor
(
255
,
0
,
0
,
128
)
# hovering
DEFAULT_SELECT_LINE_COLOR
=
QtGui
.
QColor
(
255
,
255
,
255
)
# selected
DEFAULT_SELECT_FILL_COLOR
=
QtGui
.
QColor
(
0
,
128
,
255
,
155
)
# selected
DEFAULT_VERTEX_FILL_COLOR
=
QtGui
.
QColor
(
0
,
255
,
0
,
255
)
# hovering
DEFAULT_HVERTEX_FILL_COLOR
=
QtGui
.
QColor
(
255
,
0
,
0
,
255
)
# hovering
class
Shape
(
object
):
...
...
@@ -156,7 +156,7 @@ class Shape(object):
painter
.
drawPath
(
line_path
)
painter
.
drawPath
(
vrtx_path
)
painter
.
fillPath
(
vrtx_path
,
self
.
vertex_fill_color
)
painter
.
fillPath
(
vrtx_path
,
self
.
_
vertex_fill_color
)
if
self
.
fill
:
color
=
self
.
select_fill_color
\
if
self
.
selected
else
self
.
fill_color
...
...
@@ -170,9 +170,9 @@ class Shape(object):
size
,
shape
=
self
.
_highlightSettings
[
self
.
_highlightMode
]
d
*=
size
if
self
.
_highlightIndex
is
not
None
:
self
.
vertex_fill_color
=
self
.
hvertex_fill_color
self
.
_
vertex_fill_color
=
self
.
hvertex_fill_color
else
:
self
.
vertex_fill_color
=
Shape
.
vertex_fill_color
self
.
_vertex_fill_color
=
self
.
vertex_fill_color
if
shape
==
self
.
P_SQUARE
:
path
.
addRect
(
point
.
x
()
-
d
/
2
,
point
.
y
()
-
d
/
2
,
d
,
d
)
elif
shape
==
self
.
P_ROUND
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录