def categories(self): label_cat = LabelCategories() label_cat.add(VOC.VocLabel(1).name) label_cat.add('non_voc_label') return { AnnotationType.label: label_cat, }
def __iter__(self): yield DatasetItem(id=1, annotations=[ Bbox(2, 3, 4, 5, label=self._label( VOC.VocLabel(1).name), id=1, group=1, attributes={ 'truncated': False, 'difficult': False, 'occluded': False, }), Bbox(1, 2, 3, 4, label=self._label('non_voc_label'), id=2, group=2, attributes={ 'truncated': False, 'difficult': False, 'occluded': False, }), ])
def __iter__(self): return iter([ DatasetItem( id='2007_000001', subset='train', image=Image(path='2007_000001.jpg', size=(10, 20)), annotations=[ Label(self._label(l.name)) for l in VOC.VocLabel if l.value % 2 == 1 ] + [ Bbox( 1, 2, 2, 2, label=self._label('cat'), attributes={ 'pose': VOC.VocPose(1).name, 'truncated': True, 'difficult': False, 'occluded': False, }, id=1, group=1, ), Bbox( 4, 5, 2, 2, label=self._label('person'), attributes={ 'truncated': False, 'difficult': False, 'occluded': False, **{ a.name: a.value % 2 == 1 for a in VOC.VocAction } }, id=2, group=2, ), Bbox(5.5, 6, 2, 2, label=self._label(VOC.VocBodyPart(1).name), group=2), Mask( image=np.ones([5, 10]), label=self._label(VOC.VocLabel(2).name), group=1, ), ]), DatasetItem(id='2007_000002', subset='test', image=np.ones((10, 20, 3))), ])
def __iter__(self): return iter([ DatasetItem(id=1, subset='a', annotations=[ Mask(image=bit(x, y, shape=[10, 10]), label=self._label(VOC.VocLabel(3).name), group=10 * y + x + 1 ) for y in range(10) for x in range(10) ]), ])
def __iter__(self): return iter([ DatasetItem(id='2007_000001', subset='train', annotations=[ Mask(image=np.ones([5, 10]), label=self._label(VOC.VocLabel(2).name), group=1, ), ] ), DatasetItem(id='2007_000002', subset='test') ])