class documentation

An object in COCO format.

Parameters
idthe ID of the annotation
image_idthe ID of the image in which the annotation appears
category_idthe category ID of the object
bboxa bounding box for the object in [xmin, ymin, width, height] format
segmentationthe segmentation data for the object
keypointsthe keypoints data for the object
scorea confidence score for the object
areathe area of the bounding box, in pixels
iscrowdwhether the object is a crowd
**attributesadditional custom attributes
Class Method from_anno_dict Creates a COCOObject from a COCO annotation dict.
Class Method from_label Creates a COCOObject from a compatible fiftyone.core.labels.Label.
Method __init__ Undocumented
Method to_anno_dict Returns a COCO annotation dictionary representation of the object.
Method to_detection Returns a fiftyone.core.labels.Detection representation of the object.
Method to_keypoints Returns a fiftyone.core.labels.Keypoint representation of the object.
Method to_polyline 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_id Undocumented
Instance Variable id Undocumented
Instance Variable image_id Undocumented
Instance Variable iscrowd Undocumented
Instance Variable keypoints Undocumented
Instance Variable score Undocumented
Instance Variable segmentation Undocumented
Method _get_label Undocumented
Method _get_object_label_and_attributes Undocumented
@classmethod
def from_anno_dict(cls, d, extra_attrs=True): (source)

Creates a COCOObject from a COCO annotation dict.

Parameters
da COCO annotation dict
extra_attrs:True

whether to load extra annotation attributes. Supported values are:

  • True: load all extra attributes
  • False: do not load extra attributes
  • a name or list of names of specific attributes to load
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)

Creates a COCOObject from a compatible fiftyone.core.labels.Label.

Parameters
labela fiftyone.core.labels.Detection, fiftyone.core.labels.Polyline, or fiftyone.core.labels.Keypoint
metadataa fiftyone.core.metadata.ImageMetadata for the image
image_id:Nonean image ID
category_id:Nonethe category ID for the object
keypoint:Nonean optional fiftyone.core.labels.Keypoint containing keypoints to include for the object
extra_attrs:True

whether to include extra attributes from the object. Supported values are:

  • True: include all extra attributes found
  • False: do not include extra attributes
  • a name or list of names of specific attributes to include
id_attr:Nonethe 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)
num_decimals:Nonean optional number of decimal places at which to round bounding box pixel coordinates. By default, no rounding is done
tolerance:Nonea 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_anno_dict(self): (source)

Returns a COCO annotation dictionary representation of the object.

Returns
a COCO annotation dict
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_sizethe (width, height) of the image
classes_map:Nonea dict mapping class IDs to class labels
supercategory_map:Nonea dict mapping class names to category dicts
load_segmentation:Falsewhether to load the segmentation mask for the object, if available
include_id:Falsewhether 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_sizethe (width, height) of the image
classes_map:Nonea dict mapping class IDs to class labels
supercategory_map:Nonea dict mapping class names to category dicts
include_id:Falsewhether 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_sizethe (width, height) of the image
classes_map:Nonea dict mapping class IDs to class labels
supercategory_map:Nonea dict mapping class names to category dicts
tolerance:Nonea tolerance, in pixels, when generating approximate polylines for instance masks. Typical values are 1-3 pixels
include_id:Falsewhether 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

Undocumented

attributes = (source)

Undocumented

Undocumented

category_id: None = (source)

Undocumented

Undocumented

image_id: None = (source)

Undocumented

Undocumented

keypoints: None = (source)

Undocumented

Undocumented

segmentation: None = (source)

Undocumented

def _get_label(self, classes): (source)

Undocumented

def _get_object_label_and_attributes(self, classes_map, supercategory_map, include_id): (source)

Undocumented