|
|
|
|
@ -110,20 +110,20 @@ class CvatExtractorTest(TestCase):
|
|
|
|
|
return iter([
|
|
|
|
|
DatasetItem(id=0, subset='train', image=np.ones((8, 8, 3)),
|
|
|
|
|
annotations=[
|
|
|
|
|
Bbox(0, 2, 4, 2, label=0,
|
|
|
|
|
Bbox(0, 2, 4, 2, label=0, z_order=1,
|
|
|
|
|
attributes={
|
|
|
|
|
'occluded': True, 'z_order': 1,
|
|
|
|
|
'occluded': True,
|
|
|
|
|
'a1': True, 'a2': 'v3'
|
|
|
|
|
}),
|
|
|
|
|
PolyLine([1, 2, 3, 4, 5, 6, 7, 8],
|
|
|
|
|
attributes={'occluded': False, 'z_order': 0}),
|
|
|
|
|
PolyLine([1, 2, 3, 4, 5, 6, 7, 8], z_order=0,
|
|
|
|
|
attributes={'occluded': False}),
|
|
|
|
|
]),
|
|
|
|
|
DatasetItem(id=1, subset='train', image=np.ones((10, 10, 3)),
|
|
|
|
|
annotations=[
|
|
|
|
|
Polygon([1, 2, 3, 4, 6, 5],
|
|
|
|
|
attributes={'occluded': False, 'z_order': 1}),
|
|
|
|
|
Points([1, 2, 3, 4, 5, 6], label=1,
|
|
|
|
|
attributes={'occluded': False, 'z_order': 2}),
|
|
|
|
|
Polygon([1, 2, 3, 4, 6, 5], z_order=1,
|
|
|
|
|
attributes={'occluded': False}),
|
|
|
|
|
Points([1, 2, 3, 4, 5, 6], label=1, z_order=2,
|
|
|
|
|
attributes={'occluded': False}),
|
|
|
|
|
]),
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
@ -163,7 +163,7 @@ class CvatConverterTest(TestCase):
|
|
|
|
|
for i in range(10):
|
|
|
|
|
label_categories.add(str(i))
|
|
|
|
|
label_categories.items[2].attributes.update(['a1', 'a2'])
|
|
|
|
|
label_categories.attributes.update(['z_order', 'occluded'])
|
|
|
|
|
label_categories.attributes.update(['occluded'])
|
|
|
|
|
|
|
|
|
|
class SrcExtractor(Extractor):
|
|
|
|
|
def __iter__(self):
|
|
|
|
|
@ -194,9 +194,9 @@ class CvatConverterTest(TestCase):
|
|
|
|
|
|
|
|
|
|
DatasetItem(id=2, subset='s2', image=np.ones((5, 10, 3)),
|
|
|
|
|
annotations=[
|
|
|
|
|
Polygon([0, 0, 4, 0, 4, 4],
|
|
|
|
|
Polygon([0, 0, 4, 0, 4, 4], z_order=1,
|
|
|
|
|
label=3, group=4,
|
|
|
|
|
attributes={ 'z_order': 1, 'occluded': False }),
|
|
|
|
|
attributes={ 'occluded': False }),
|
|
|
|
|
PolyLine([5, 0, 9, 0, 5, 5]), # will be skipped as no label
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
@ -213,15 +213,15 @@ class CvatConverterTest(TestCase):
|
|
|
|
|
return iter([
|
|
|
|
|
DatasetItem(id=0, subset='s1', image=np.zeros((5, 10, 3)),
|
|
|
|
|
annotations=[
|
|
|
|
|
Polygon([0, 0, 4, 0, 4, 4],
|
|
|
|
|
Polygon([0, 0, 4, 0, 4, 4], z_order=0,
|
|
|
|
|
label=1, group=4,
|
|
|
|
|
attributes={ 'z_order': 0, 'occluded': True }),
|
|
|
|
|
Polygon([5, 0, 9, 0, 5, 5],
|
|
|
|
|
attributes={ 'occluded': True }),
|
|
|
|
|
Polygon([5, 0, 9, 0, 5, 5], z_order=0,
|
|
|
|
|
label=2, group=4,
|
|
|
|
|
attributes={ 'z_order': 0, 'occluded': False }),
|
|
|
|
|
Points([1, 1, 3, 2, 2, 3],
|
|
|
|
|
attributes={ 'occluded': False }),
|
|
|
|
|
Points([1, 1, 3, 2, 2, 3], z_order=0,
|
|
|
|
|
label=2,
|
|
|
|
|
attributes={ 'z_order': 0, 'occluded': False,
|
|
|
|
|
attributes={ 'occluded': False,
|
|
|
|
|
'a1': 'x', 'a2': 42 }),
|
|
|
|
|
Label(1),
|
|
|
|
|
Label(2, attributes={ 'a1': 'y', 'a2': 44 }),
|
|
|
|
|
@ -229,20 +229,20 @@ class CvatConverterTest(TestCase):
|
|
|
|
|
),
|
|
|
|
|
DatasetItem(id=1, subset='s1',
|
|
|
|
|
annotations=[
|
|
|
|
|
PolyLine([0, 0, 4, 0, 4, 4],
|
|
|
|
|
PolyLine([0, 0, 4, 0, 4, 4], z_order=0,
|
|
|
|
|
label=3, group=4,
|
|
|
|
|
attributes={ 'z_order': 0, 'occluded': False }),
|
|
|
|
|
Bbox(5, 0, 1, 9,
|
|
|
|
|
attributes={ 'occluded': False }),
|
|
|
|
|
Bbox(5, 0, 1, 9, z_order=0,
|
|
|
|
|
label=3, group=4,
|
|
|
|
|
attributes={ 'z_order': 0, 'occluded': False }),
|
|
|
|
|
attributes={ 'occluded': False }),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
DatasetItem(id=2, subset='s2', image=np.ones((5, 10, 3)),
|
|
|
|
|
annotations=[
|
|
|
|
|
Polygon([0, 0, 4, 0, 4, 4],
|
|
|
|
|
Polygon([0, 0, 4, 0, 4, 4], z_order=1,
|
|
|
|
|
label=3, group=4,
|
|
|
|
|
attributes={ 'z_order': 1, 'occluded': False }),
|
|
|
|
|
attributes={ 'occluded': False }),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|