Skip to content

Commit 599d5d6

Browse files
committed
Fix multi template coco converter
1 parent 7b6c348 commit 599d5d6

File tree

4 files changed

+378
-5
lines changed

4 files changed

+378
-5
lines changed

superannotate/input_converters/converters/coco_converters/coco_to_sa_vector.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,8 @@ def coco_keypoint_detection_to_sa_vector(coco_path, output_dir):
218218
for connection in cat_id_to_cat[annot["category_id"]
219219
]['skeleton']:
220220

221-
index = cat['skeleton'].index(connection)
222-
from_point = cat_id_to_cat[annot["category_id"]
223-
]['skeleton'][index][0]
224-
to_point = cat_id_to_cat[annot["category_id"]
225-
]['skeleton'][index][1]
221+
from_point = connection[0]
222+
to_point = connection[1]
226223

227224
if from_point in bad_points or to_point in bad_points:
228225
continue
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
{
2+
"info": {
3+
"description": "This is dataset.",
4+
"url": "https://superannotate.ai",
5+
"version": "1.0",
6+
"year": 2021,
7+
"contributor": "Superannotate AI",
8+
"date_created": "01/06/2021"
9+
},
10+
"licenses": [
11+
{
12+
"url": "https://superannotate.ai",
13+
"id": 1,
14+
"name": "Superannotate AI"
15+
}
16+
],
17+
"images": [
18+
{
19+
"id": 1,
20+
"file_name": "68307_47130_68308_47130_68307_47131_68308_47131_0.png",
21+
"height": 1000,
22+
"width": 1000,
23+
"license": 1
24+
}
25+
],
26+
"annotations": [
27+
{
28+
"id": 1,
29+
"image_id": 1,
30+
"iscrowd": 0,
31+
"bbox": [
32+
271,
33+
114,
34+
182,
35+
248
36+
],
37+
"area": 45136,
38+
"num_keypoints": 5,
39+
"keypoints": [
40+
271.99,
41+
114.9,
42+
2,
43+
419.26,
44+
137.22,
45+
2,
46+
279.01,
47+
351.5,
48+
2,
49+
453.32,
50+
362.66,
51+
2,
52+
349.13,
53+
233.2,
54+
2
55+
],
56+
"category_id": 1
57+
},
58+
{
59+
"id": 2,
60+
"image_id": 1,
61+
"iscrowd": 0,
62+
"bbox": [
63+
668,
64+
208,
65+
131,
66+
208
67+
],
68+
"area": 27248,
69+
"num_keypoints": 4,
70+
"keypoints": [
71+
668.76,
72+
219.62,
73+
2,
74+
763.61,
75+
208.26,
76+
2,
77+
799.82,
78+
377.39,
79+
2,
80+
713.64,
81+
416.52,
82+
2
83+
],
84+
"category_id": 2
85+
},
86+
{
87+
"id": 3,
88+
"image_id": 1,
89+
"iscrowd": 0,
90+
"bbox": [
91+
455,
92+
522,
93+
273,
94+
194
95+
],
96+
"area": 52962,
97+
"num_keypoints": 4,
98+
"keypoints": [
99+
455.12,
100+
533.02,
101+
2,
102+
652.62,
103+
522.44,
104+
2,
105+
728.01,
106+
679.91,
107+
2,
108+
548.56,
109+
716.34,
110+
2
111+
],
112+
"category_id": 2
113+
}
114+
],
115+
"categories": [
116+
{
117+
"name": "custom",
118+
"supercategory": "class1",
119+
"skeleton": [
120+
[
121+
1,
122+
5
123+
],
124+
[
125+
2,
126+
5
127+
],
128+
[
129+
5,
130+
3
131+
],
132+
[
133+
5,
134+
4
135+
]
136+
],
137+
"keypoints": [
138+
"ca",
139+
"cb",
140+
"cd",
141+
"cc",
142+
"ce"
143+
],
144+
"id": 1
145+
},
146+
{
147+
"name": "template2",
148+
"supercategory": "class1",
149+
"skeleton": [
150+
[
151+
1,
152+
4
153+
],
154+
[
155+
2,
156+
4
157+
],
158+
[
159+
3,
160+
4
161+
]
162+
],
163+
"keypoints": [
164+
"ta",
165+
"tb",
166+
"tc",
167+
"td"
168+
],
169+
"id": 2
170+
}
171+
]
172+
}
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
{
2+
"instances": [
3+
{
4+
"type": "template",
5+
"pointLabels": {
6+
"0": "ca",
7+
"1": "cb",
8+
"2": "cd",
9+
"3": "cc",
10+
"4": "ce"
11+
},
12+
"attributes": [],
13+
"creationType": "Pre-annotation",
14+
"points": [
15+
{
16+
"id": 1,
17+
"x": 271.99,
18+
"y": 114.9
19+
},
20+
{
21+
"id": 2,
22+
"x": 419.26,
23+
"y": 137.22
24+
},
25+
{
26+
"id": 3,
27+
"x": 279.01,
28+
"y": 351.5
29+
},
30+
{
31+
"id": 4,
32+
"x": 453.32,
33+
"y": 362.66
34+
},
35+
{
36+
"id": 5,
37+
"x": 349.13,
38+
"y": 233.2
39+
}
40+
],
41+
"connections": [
42+
{
43+
"id": 7,
44+
"from": 1,
45+
"to": 5
46+
},
47+
{
48+
"id": 7,
49+
"from": 2,
50+
"to": 5
51+
},
52+
{
53+
"id": 7,
54+
"from": 5,
55+
"to": 3
56+
},
57+
{
58+
"id": 7,
59+
"from": 5,
60+
"to": 4
61+
}
62+
],
63+
"className": "custom"
64+
},
65+
{
66+
"type": "template",
67+
"pointLabels": {
68+
"0": "ta",
69+
"1": "tb",
70+
"2": "tc",
71+
"3": "td"
72+
},
73+
"attributes": [],
74+
"creationType": "Pre-annotation",
75+
"points": [
76+
{
77+
"id": 1,
78+
"x": 668.76,
79+
"y": 219.62
80+
},
81+
{
82+
"id": 2,
83+
"x": 763.61,
84+
"y": 208.26
85+
},
86+
{
87+
"id": 3,
88+
"x": 799.82,
89+
"y": 377.39
90+
},
91+
{
92+
"id": 4,
93+
"x": 713.64,
94+
"y": 416.52
95+
}
96+
],
97+
"connections": [
98+
{
99+
"id": 6,
100+
"from": 1,
101+
"to": 4
102+
},
103+
{
104+
"id": 6,
105+
"from": 2,
106+
"to": 4
107+
},
108+
{
109+
"id": 6,
110+
"from": 3,
111+
"to": 4
112+
}
113+
],
114+
"className": "template2"
115+
},
116+
{
117+
"type": "template",
118+
"pointLabels": {
119+
"0": "ta",
120+
"1": "tb",
121+
"2": "tc",
122+
"3": "td"
123+
},
124+
"attributes": [],
125+
"creationType": "Pre-annotation",
126+
"points": [
127+
{
128+
"id": 1,
129+
"x": 455.12,
130+
"y": 533.02
131+
},
132+
{
133+
"id": 2,
134+
"x": 652.62,
135+
"y": 522.44
136+
},
137+
{
138+
"id": 3,
139+
"x": 728.01,
140+
"y": 679.91
141+
},
142+
{
143+
"id": 4,
144+
"x": 548.56,
145+
"y": 716.34
146+
}
147+
],
148+
"connections": [
149+
{
150+
"id": 6,
151+
"from": 1,
152+
"to": 4
153+
},
154+
{
155+
"id": 6,
156+
"from": 2,
157+
"to": 4
158+
},
159+
{
160+
"id": 6,
161+
"from": 3,
162+
"to": 4
163+
}
164+
],
165+
"className": "template2"
166+
}
167+
],
168+
"metadata": {
169+
"name": "68307_47130_68308_47130_68307_47131_68308_47131_0.png",
170+
"width": 1000,
171+
"height": 1000
172+
},
173+
"tags": [],
174+
"comments": []
175+
}

0 commit comments

Comments
 (0)