Skip to content

Commit 934d072

Browse files
committed
Merge branch 'develop' into 'fb-ROOT-17'
Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/15255913195
2 parents a600be8 + e2b965e commit 934d072

File tree

3 files changed

+149
-5
lines changed

3 files changed

+149
-5
lines changed

docs/source/guide/export.md

Lines changed: 142 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,144 @@ Export your brush mask labels as NumPy 2d arrays and PNG images. Each label outp
121121

122122
### COCO
123123

124-
A popular machine learning format used by the [COCO dataset](http://cocodataset.org/#home) for object detection and image segmentation tasks. Supports bounding box and polygon image labeling projects that use the `BrushLabels`, `RectangleLabels`, or `PolygonLabels` tags.
124+
A popular machine learning format used by the [COCO dataset](http://cocodataset.org/#home) for object detection and image segmentation tasks. Supports bounding box and polygon image labeling projects that use the `BrushLabels`, `RectangleLabels`, `KeyPointLabels` (see note below), or `PolygonLabels` tags.
125+
126+
127+
{% details <b>KeyPointLabels Export Support</b> %}
128+
129+
If using `KeyPointLabels`, you will need to add the following to your labeling config:
130+
131+
* At least one `<RectangleLabels>` option. You will use this as a parent bounding box for the keypoints.
132+
* Add a `model_index` to every `<Label>` inside your `<KeyPointLabels>` tag. The `model_index` value defines the order of the keypoint coordinates in the output array for YOLO.
133+
134+
For example:
135+
136+
```xml
137+
<View>
138+
<Image name="image" value="$image"/>
139+
140+
<KeyPointLabels name="kp" toName="image">
141+
<Label value="nose" model_index="0"/>
142+
<Label value="eye" model_index="1"/>
143+
<Label value="tail" model_index="2"/>
144+
</KeyPointLabels>
145+
146+
<RectangleLabels name="bbox" toName="image">
147+
<Label value="animal"/>
148+
</RectangleLabels>
149+
</View>
150+
151+
```
152+
153+
After annotating, you must drag-and-drop each keypoint region under its corresponding rectangle region in the **Regions** panel.
154+
155+
This establishes a parent–child hierarchy (via parentID), which is necessary for export. See the export examples below.
156+
157+
![Screenshot of keypoints within a bounding box](/images/import-export/keypoints.png)
158+
159+
**Export examples**
160+
161+
<div class="code-tabs">
162+
<div data-name="Keypoints in JSON">
163+
```json
164+
[
165+
{
166+
"result": [
167+
{
168+
"id": "17n06ubOJs",
169+
"type": "keypointlabels",
170+
"value": {
171+
"x": 6.675567423230974,
172+
"y": 20.597014925373134,
173+
"width": 0.26702269692923897,
174+
"keypointlabels": [
175+
"nose"
176+
]
177+
},
178+
"origin": "manual",
179+
"to_name": "image",
180+
"parentID": "QHG4TBXuNC",
181+
"from_name": "kp",
182+
"image_rotation": 0,
183+
"original_width": 200,
184+
"original_height": 179
185+
},
186+
{
187+
"id": "QHG4TBXuNC",
188+
"type": "rectanglelabels",
189+
"value": {
190+
"x": 3.871829105473965,
191+
"y": 4.029850746268656,
192+
"width": 94.39252336448598,
193+
"height": 92.08955223880598,
194+
"rotation": 0,
195+
"rectanglelabels": [
196+
"animal"
197+
]
198+
},
199+
"origin": "manual",
200+
"to_name": "image",
201+
"from_name": "bbox",
202+
"image_rotation": 0,
203+
"original_width": 200,
204+
"original_height": 179
205+
}
206+
]
207+
```
208+
</div>
209+
<div data-name="Keypoints in COCO">
210+
```json
211+
[
212+
{
213+
"id": 0,
214+
"image_id": 0,
215+
"category_id": 0,
216+
"segmentation": [],
217+
"bbox": [
218+
7.74365821094793,
219+
7.213432835820895,
220+
188.78504672897196,
221+
164.84029850746268
222+
],
223+
"ignore": 0,
224+
"iscrowd": 0,
225+
"area": 31119.38345654903
226+
},
227+
{
228+
"id": 1,
229+
"image_id": 0,
230+
"category_id": 0,
231+
"keypoints": [
232+
13,
233+
37,
234+
2,
235+
33,
236+
33,
237+
2,
238+
167,
239+
24,
240+
2
241+
],
242+
"num_keypoints": 3,
243+
"bbox": [
244+
13,
245+
24,
246+
154,
247+
13
248+
],
249+
"iscrowd": 0
250+
}
251+
]
252+
```
253+
</div>
254+
<div data-name="Keypoints in YOLO">
255+
```
256+
0 0.5106809078771696 0.5007462686567165 0.9439252336448598 0.9208955223880598 0.06675567423230974 0.20597014925373133 2 0.1628838451268358 0.18507462686567164 2 0.8371161548731643 0.13134328358208955 2
257+
```
258+
</div>
259+
</div>
260+
{% enddetails %}
261+
125262

126263
### CoNLL2003
127264

@@ -189,7 +326,10 @@ Results are stored in a tab-separated tabular file with column names specified b
189326

190327
### YOLO
191328

192-
Export object detection annotations in the YOLOv3 and YOLOv4 format. Supports object detection labeling projects that use the `RectangleLabels` tag.
329+
Export object detection annotations in the YOLOv3 and YOLOv4 format. Supports object detection labeling projects that use the `RectangleLabels` and `KeyPointLabels` tags.
330+
331+
!!! note
332+
If using KeyPointLabels, see the note under [COCO](#COCO).
193333

194334
{% insertmd includes/task_format.md %}
195335

Loading

web/libs/editor/src/components/SidePanels/DetailsPanel/TimelineRegionEditor.module.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@
1212

1313
.input {
1414
display: block;
15-
border: 1px solid var(--sand_300);
15+
border: 1px solid var(--color-neutral-border);
1616
border-radius: 4px;
1717
padding: 0 0 0 8px;
1818
width: 80px;
1919
font-size: 14px;
2020
text-align: right;
2121

2222
&[readonly] {
23-
background-color: var(--sand_100);
24-
color: var(--color-neutral-content-subtler);
23+
color: var(--color-neutral-content-subtlest);
24+
cursor: default;
25+
26+
&:focus {
27+
outline: none;
28+
}
2529
}
2630
}

0 commit comments

Comments
 (0)