class documentation
class COCOObject(object): (source)
Constructor: COCOObject(id, image_id, category_id, bbox, ...)
An object in COCO format.
Parameters | |
id | the ID of the annotation |
image | the ID of the image in which the annotation appears |
category | the category ID of the object |
bbox | a bounding box for the object in [xmin, ymin, width, height] format |
segmentation | the segmentation data for the object |
keypoints | the keypoints data for the object |
score | a confidence score for the object |
area | the area of the bounding box, in pixels |
iscrowd | whether the object is a crowd |
**attributes | additional custom attributes |
Class Method | from |
Creates a COCOObject from a COCO annotation dict. |
Class Method | from |
Creates a COCOObject from a compatible fiftyone.core.labels.Label . |
Method | __init__ |
Undocumented |
Method | to |
Returns a COCO annotation dictionary representation of the object. |
Method | to |
Returns a fiftyone.core.labels.Detection representation of the object. |
Method | to |
Returns a fiftyone.core.labels.Keypoint representation of the object. |
Method | to |
Returns a fiftyone.core.labels.Polyline representation of the object. |
Instance Variable | area |
Undocumented |
Instance Variable | attributes |
Undocumented |
Instance Variable | bbox |
Undocumented |
Instance Variable | category |
Undocumented |
Instance Variable | id |
Undocumented |
Instance Variable | image |
Undocumented |
Instance Variable | iscrowd |
Undocumented |
Instance Variable | keypoints |
Undocumented |
Instance Variable | score |
Undocumented |
Instance Variable | segmentation |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Creates a COCOObject
from a COCO annotation dict.
Parameters | |
d | a COCO annotation dict |
extraTrue | whether to load extra annotation attributes. Supported values are:
|
Returns | |
a COCOObject |
@classmethod
def from_label(cls, label, metadata, image_id=None, category_id=None, keypoint=None, extra_attrs=True, id_attr=None, iscrowd='iscrowd', num_decimals=None, tolerance=None): (source) ¶
def from_label(cls, label, metadata, image_id=None, category_id=None, keypoint=None, extra_attrs=True, id_attr=None, iscrowd='iscrowd', num_decimals=None, tolerance=None): (source) ¶
Creates a COCOObject
from a compatible
fiftyone.core.labels.Label
.
Parameters | |
label | a fiftyone.core.labels.Detection ,
fiftyone.core.labels.Polyline , or
fiftyone.core.labels.Keypoint |
metadata | a fiftyone.core.metadata.ImageMetadata for the
image |
imageNone | an image ID |
categoryNone | the category ID for the object |
keypoint:None | an optional fiftyone.core.labels.Keypoint
containing keypoints to include for the object |
extraTrue | whether to include extra attributes from the object. Supported values are:
|
idNone | the name of the attribute containing the annotation ID of the label, if any |
iscrowd:"iscrowd" | the name of the crowd attribute (the value is automatically set to 0 if the attribute is not present) |
numNone | an optional number of decimal places at which to round bounding box pixel coordinates. By default, no rounding is done |
tolerance:None | a tolerance, in pixels, when generating approximate polylines for instance masks. Typical values are 1-3 pixels |
Returns | |
a COCOObject |
def __init__(self, id=None, image_id=None, category_id=None, bbox=None, segmentation=None, keypoints=None, score=None, area=None, iscrowd=None, **attributes):
(source)
¶
Undocumented
def to_detection(self, frame_size, classes_map=None, supercategory_map=None, load_segmentation=False, include_id=False):
(source)
¶
Returns a fiftyone.core.labels.Detection
representation of
the object.
Parameters | |
frame | the (width, height) of the image |
classesNone | a dict mapping class IDs to class labels |
supercategoryNone | a dict mapping class names to category dicts |
loadFalse | whether to load the segmentation mask for the object, if available |
includeFalse | whether to include the COCO ID of the object as a label attribute |
Returns | |
a fiftyone.core.labels.Detection , or None if no bbox data
is available |
def to_keypoints(self, frame_size, classes_map=None, supercategory_map=None, include_id=False):
(source)
¶
Returns a fiftyone.core.labels.Keypoint
representation of
the object.
Parameters | |
frame | the (width, height) of the image |
classesNone | a dict mapping class IDs to class labels |
supercategoryNone | a dict mapping class names to category dicts |
includeFalse | whether to include the COCO ID of the object as a label attribute |
Returns | |
a fiftyone.core.labels.Keypoint , or None if no keypoints
data is available |
def to_polyline(self, frame_size, classes_map=None, supercategory_map=None, tolerance=None, include_id=False):
(source)
¶
Returns a fiftyone.core.labels.Polyline
representation of
the object.
Parameters | |
frame | the (width, height) of the image |
classesNone | a dict mapping class IDs to class labels |
supercategoryNone | a dict mapping class names to category dicts |
tolerance:None | a tolerance, in pixels, when generating approximate polylines for instance masks. Typical values are 1-3 pixels |
includeFalse | whether to include the COCO ID of the object as a label attribute |
Returns | |
a fiftyone.core.labels.Polyline , or None if no
segmentation data is available |