|
|
|
|
@ -15,13 +15,12 @@ import pycocotools.mask as mask_utils
|
|
|
|
|
import datumaro.util.annotation_tools as anno_tools
|
|
|
|
|
import datumaro.util.mask_tools as mask_tools
|
|
|
|
|
from datumaro.components.converter import Converter
|
|
|
|
|
from datumaro.components.extractor import (DEFAULT_SUBSET_NAME, AnnotationType,
|
|
|
|
|
Points)
|
|
|
|
|
from datumaro.components.extractor import (_COORDINATE_ROUNDING_DIGITS,
|
|
|
|
|
DEFAULT_SUBSET_NAME, AnnotationType, Points)
|
|
|
|
|
from datumaro.util import cast, find, str_to_bool
|
|
|
|
|
|
|
|
|
|
from .format import CocoPath, CocoTask
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SegmentationMode = Enum('SegmentationMode', ['guess', 'polygons', 'mask'])
|
|
|
|
|
|
|
|
|
|
class _TaskConverter:
|
|
|
|
|
@ -308,7 +307,7 @@ class _InstancesConverter(_TaskConverter):
|
|
|
|
|
'category_id': cast(ann.label, int, -1) + 1,
|
|
|
|
|
'segmentation': segmentation,
|
|
|
|
|
'area': float(area),
|
|
|
|
|
'bbox': list(map(float, bbox)),
|
|
|
|
|
'bbox': [round(float(n), _COORDINATE_ROUNDING_DIGITS) for n in bbox],
|
|
|
|
|
'iscrowd': int(is_crowd),
|
|
|
|
|
}
|
|
|
|
|
if 'score' in ann.attributes:
|
|
|
|
|
@ -336,7 +335,6 @@ class _KeypointsConverter(_InstancesConverter):
|
|
|
|
|
'supercategory': cast(label_cat.parent, str, ''),
|
|
|
|
|
'keypoints': [],
|
|
|
|
|
'skeleton': [],
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if point_categories is not None:
|
|
|
|
|
|