<!-- # hard line break macro for HTML -->

# fiftyone.core.labels

Labels stored in dataset samples.

Copyright 2017-2026, Voxel51, Inc.
<br/>
[voxel51.com](https://voxel51.com/)
<br/>
<br/>

**Classes:**

| [`Label`](#fiftyone.core.labels.Label)(\*args, \*\*kwargs)                               | Base class for labels.                                                             |
|------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| [`Attribute`](#fiftyone.core.labels.Attribute)(\*args, \*\*kwargs)                       | Base class for attributes.                                                         |
| [`BooleanAttribute`](#fiftyone.core.labels.BooleanAttribute)(\*args, \*\*kwargs)         | A boolean attribute.                                                               |
| [`CategoricalAttribute`](#fiftyone.core.labels.CategoricalAttribute)(\*args, \*\*kwargs) | A categorical attribute.                                                           |
| [`NumericAttribute`](#fiftyone.core.labels.NumericAttribute)(\*args, \*\*kwargs)         | A numeric attribute.                                                               |
| [`ListAttribute`](#fiftyone.core.labels.ListAttribute)(\*args, \*\*kwargs)               | A list attribute.                                                                  |
| [`Instance`](#fiftyone.core.labels.Instance)(\*args, \*\*kwargs)                         | A label instance.                                                                  |
| [`Regression`](#fiftyone.core.labels.Regression)(\*args, \*\*kwargs)                     | A regression value.                                                                |
| [`Classification`](#fiftyone.core.labels.Classification)(\*args, \*\*kwargs)             | A classification label.                                                            |
| [`Classifications`](#fiftyone.core.labels.Classifications)(\*args, \*\*kwargs)           | A list of classifications for an image.                                            |
| [`Detection`](#fiftyone.core.labels.Detection)(\*args, \*\*kwargs)                       | An object detection.                                                               |
| [`Detections`](#fiftyone.core.labels.Detections)(\*args, \*\*kwargs)                     | A list of object detections in an image.                                           |
| [`Polyline`](#fiftyone.core.labels.Polyline)(\*args, \*\*kwargs)                         | A set of semantically related polylines or polygons.                               |
| [`Polylines`](#fiftyone.core.labels.Polylines)(\*args, \*\*kwargs)                       | A list of polylines or polygons in an image.                                       |
| [`Keypoint`](#fiftyone.core.labels.Keypoint)(\*args, \*\*kwargs)                         | A list of keypoints in an image.                                                   |
| [`Keypoints`](#fiftyone.core.labels.Keypoints)(\*args, \*\*kwargs)                       | A list of [`Keypoint`](#fiftyone.core.labels.Keypoint) instances in an image.      |
| [`Segmentation`](#fiftyone.core.labels.Segmentation)(\*args, \*\*kwargs)                 | A semantic segmentation for an image.                                              |
| [`Heatmap`](#fiftyone.core.labels.Heatmap)(\*args, \*\*kwargs)                           | A heatmap for an image.                                                            |
| [`TemporalDetection`](#fiftyone.core.labels.TemporalDetection)(\*args, \*\*kwargs)       | A temporal detection in a video whose support is defined by a start and end frame. |
| [`TemporalDetections`](#fiftyone.core.labels.TemporalDetections)(\*args, \*\*kwargs)     | A list of temporal detections for a video.                                         |
| [`GeoLocation`](#fiftyone.core.labels.GeoLocation)(\*args, \*\*kwargs)                   | Location data in GeoJSON format.                                                   |
| [`GeoLocations`](#fiftyone.core.labels.GeoLocations)(\*args, \*\*kwargs)                 | A batch of location data in GeoJSON format.                                        |

### *class* fiftyone.core.labels.Label(\*args, \*\*kwargs)

Bases: [`DynamicEmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument)

Base class for labels.

Label instances represent a logical collection of data associated with a
particular task for a sample or frame in a dataset.

**Methods:**

| [`iter_attributes`](#fiftyone.core.labels.Label.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                             |
|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [`has_attribute`](#fiftyone.core.labels.Label.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                       |
| [`get_attribute_value`](#fiftyone.core.labels.Label.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                     |
| [`set_attribute_value`](#fiftyone.core.labels.Label.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                     |
| [`delete_attribute`](#fiftyone.core.labels.Label.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                               |
| [`clean`](#fiftyone.core.labels.Label.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run. |
| [`clear_field`](#fiftyone.core.labels.Label.clear_field)(field_name)                      | Clears the field from the document.                                                                      |
| [`copy`](#fiftyone.core.labels.Label.copy)()                                              | Returns a deep copy of the document.                                                                     |
| [`fancy_repr`](#fiftyone.core.labels.Label.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                          |
| [`field_to_mongo`](#fiftyone.core.labels.Label.field_to_mongo)(field_name)                |                                                                                                          |
| [`field_to_python`](#fiftyone.core.labels.Label.field_to_python)(field_name, value)       |                                                                                                          |
| [`from_dict`](#fiftyone.core.labels.Label.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                          |
| [`from_json`](#fiftyone.core.labels.Label.from_json)(s)                                   | Loads the document from a JSON string.                                                                   |
| [`get_field`](#fiftyone.core.labels.Label.get_field)(field_name)                          | Gets the field of the document.                                                                          |
| [`get_text_score`](#fiftyone.core.labels.Label.get_text_score)()                          | Get text score from text query                                                                           |
| [`has_field`](#fiftyone.core.labels.Label.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                           |
| [`iter_fields`](#fiftyone.core.labels.Label.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                 |
| [`merge`](#fiftyone.core.labels.Label.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                            |
| [`set_field`](#fiftyone.core.labels.Label.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                               |
| [`to_dict`](#fiftyone.core.labels.Label.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                      |
| [`to_json`](#fiftyone.core.labels.Label.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                |
| [`to_mongo`](#fiftyone.core.labels.Label.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                           |
| [`validate`](#fiftyone.core.labels.Label.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                           |

**Attributes:**

| [`STRICT`](#fiftyone.core.labels.Label.STRICT)           |                                                         |
|----------------------------------------------------------|---------------------------------------------------------|
| [`field_names`](#fiftyone.core.labels.Label.field_names) | An ordered tuple of the public fields of this document. |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Label.my_metaclass)   |    |
|--------------------------------------------------------------|----|

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Attribute(\*args, \*\*kwargs)

Bases: [`DynamicEmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument)

Base class for attributes.

Attribute instances represent an atomic piece of information, its
`value`, usually embedded with a `name` within a dict field of another
[`Label`](#fiftyone.core.labels.Label) instance.

* **Parameters:**
  **value** (*None*) – the attribute value

**Attributes:**

| [`value`](#fiftyone.core.labels.Attribute.value)             | A generic field.                                        |
|--------------------------------------------------------------|---------------------------------------------------------|
| [`STRICT`](#fiftyone.core.labels.Attribute.STRICT)           |                                                         |
| [`field_names`](#fiftyone.core.labels.Attribute.field_names) | An ordered tuple of the public fields of this document. |

**Methods:**

| [`clean`](#fiftyone.core.labels.Attribute.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.Attribute.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.Attribute.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.labels.Attribute.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.Attribute.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.Attribute.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.Attribute.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.Attribute.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.labels.Attribute.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.Attribute.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.labels.Attribute.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.labels.Attribute.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.Attribute.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.labels.Attribute.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.Attribute.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.Attribute.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.Attribute.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.Attribute.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Attribute.my_metaclass)   |    |
|------------------------------------------------------------------|----|

#### value

A generic field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.BooleanAttribute(\*args, \*\*kwargs)

Bases: [`Attribute`](#fiftyone.core.labels.Attribute)

A boolean attribute.

* **Parameters:**
  **value** (*None*) – the attribute value

**Attributes:**

| [`value`](#fiftyone.core.labels.BooleanAttribute.value)             | A boolean field.                                        |
|---------------------------------------------------------------------|---------------------------------------------------------|
| [`STRICT`](#fiftyone.core.labels.BooleanAttribute.STRICT)           |                                                         |
| [`field_names`](#fiftyone.core.labels.BooleanAttribute.field_names) | An ordered tuple of the public fields of this document. |

**Methods:**

| [`clean`](#fiftyone.core.labels.BooleanAttribute.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.BooleanAttribute.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.BooleanAttribute.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.labels.BooleanAttribute.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.BooleanAttribute.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.BooleanAttribute.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.BooleanAttribute.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.BooleanAttribute.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.labels.BooleanAttribute.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.BooleanAttribute.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.labels.BooleanAttribute.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.labels.BooleanAttribute.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.BooleanAttribute.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.labels.BooleanAttribute.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.BooleanAttribute.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.BooleanAttribute.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.BooleanAttribute.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.BooleanAttribute.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.BooleanAttribute.my_metaclass)   |    |
|-------------------------------------------------------------------------|----|

#### value

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.CategoricalAttribute(\*args, \*\*kwargs)

Bases: [`Attribute`](#fiftyone.core.labels.Attribute)

A categorical attribute.

* **Parameters:**
  * **value** (*None*) – the attribute value
  * **confidence** (*None*) – a confidence in `[0, 1]` for the value
  * **logits** (*None*) – logits associated with the attribute

**Attributes:**

| [`value`](#fiftyone.core.labels.CategoricalAttribute.value)             | A unicode string field.                                 |
|-------------------------------------------------------------------------|---------------------------------------------------------|
| [`confidence`](#fiftyone.core.labels.CategoricalAttribute.confidence)   | A floating point number field.                          |
| [`logits`](#fiftyone.core.labels.CategoricalAttribute.logits)           | A one-dimensional array field.                          |
| [`STRICT`](#fiftyone.core.labels.CategoricalAttribute.STRICT)           |                                                         |
| [`field_names`](#fiftyone.core.labels.CategoricalAttribute.field_names) | An ordered tuple of the public fields of this document. |

**Methods:**

| [`clean`](#fiftyone.core.labels.CategoricalAttribute.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.CategoricalAttribute.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.CategoricalAttribute.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.labels.CategoricalAttribute.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.CategoricalAttribute.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.CategoricalAttribute.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.CategoricalAttribute.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.CategoricalAttribute.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.labels.CategoricalAttribute.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.CategoricalAttribute.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.labels.CategoricalAttribute.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.labels.CategoricalAttribute.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.CategoricalAttribute.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.labels.CategoricalAttribute.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.CategoricalAttribute.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.CategoricalAttribute.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.CategoricalAttribute.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.CategoricalAttribute.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.CategoricalAttribute.my_metaclass)   |    |
|-----------------------------------------------------------------------------|----|

#### value

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### confidence

A floating point number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### logits

A one-dimensional array field.

`VectorField` instances accept numeric lists, tuples, and 1D numpy
array values. The underlying data is serialized and stored in the database
as zlib-compressed bytes generated by `numpy.save` and always retrieved
as a numpy array.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.NumericAttribute(\*args, \*\*kwargs)

Bases: [`Attribute`](#fiftyone.core.labels.Attribute)

A numeric attribute.

* **Parameters:**
  **value** (*None*) – the attribute value

**Attributes:**

| [`value`](#fiftyone.core.labels.NumericAttribute.value)             | A floating point number field.                          |
|---------------------------------------------------------------------|---------------------------------------------------------|
| [`STRICT`](#fiftyone.core.labels.NumericAttribute.STRICT)           |                                                         |
| [`field_names`](#fiftyone.core.labels.NumericAttribute.field_names) | An ordered tuple of the public fields of this document. |

**Methods:**

| [`clean`](#fiftyone.core.labels.NumericAttribute.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.NumericAttribute.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.NumericAttribute.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.labels.NumericAttribute.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.NumericAttribute.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.NumericAttribute.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.NumericAttribute.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.NumericAttribute.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.labels.NumericAttribute.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.NumericAttribute.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.labels.NumericAttribute.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.labels.NumericAttribute.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.NumericAttribute.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.labels.NumericAttribute.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.NumericAttribute.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.NumericAttribute.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.NumericAttribute.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.NumericAttribute.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.NumericAttribute.my_metaclass)   |    |
|-------------------------------------------------------------------------|----|

#### value

A floating point number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.ListAttribute(\*args, \*\*kwargs)

Bases: [`Attribute`](#fiftyone.core.labels.Attribute)

A list attribute.

The list can store arbitrary JSON-serialiable values.

* **Parameters:**
  **value** (*None*) – the attribute value

**Attributes:**

| [`value`](#fiftyone.core.labels.ListAttribute.value)             | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
|------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`STRICT`](#fiftyone.core.labels.ListAttribute.STRICT)           |                                                                                                                                |
| [`field_names`](#fiftyone.core.labels.ListAttribute.field_names) | An ordered tuple of the public fields of this document.                                                                        |

**Methods:**

| [`clean`](#fiftyone.core.labels.ListAttribute.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.ListAttribute.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.ListAttribute.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.labels.ListAttribute.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.ListAttribute.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.ListAttribute.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.ListAttribute.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.ListAttribute.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.labels.ListAttribute.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.ListAttribute.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.labels.ListAttribute.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.labels.ListAttribute.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.ListAttribute.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.labels.ListAttribute.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.ListAttribute.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.ListAttribute.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.ListAttribute.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.ListAttribute.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.ListAttribute.my_metaclass)   |    |
|----------------------------------------------------------------------|----|

#### value

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Instance(\*args, \*\*kwargs)

Bases: [`EmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument)

A label instance.

* **Parameters:**
  **id** (*None*) – the label instance ID

**Attributes:**

| [`id`](#fiftyone.core.labels.Instance.id)                   | An Object ID field.                                     |
|-------------------------------------------------------------|---------------------------------------------------------|
| [`STRICT`](#fiftyone.core.labels.Instance.STRICT)           |                                                         |
| [`field_names`](#fiftyone.core.labels.Instance.field_names) | An ordered tuple of the public fields of this document. |

**Methods:**

| [`clean`](#fiftyone.core.labels.Instance.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.Instance.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.Instance.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.labels.Instance.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.Instance.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.Instance.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.Instance.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.Instance.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.labels.Instance.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.Instance.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.labels.Instance.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.labels.Instance.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.Instance.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.labels.Instance.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.Instance.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.Instance.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.Instance.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.Instance.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Instance.my_metaclass)   |    |
|-----------------------------------------------------------------|----|

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Regression(\*args, \*\*kwargs)

Bases: `_HasID`, [`Label`](#fiftyone.core.labels.Label)

A regression value.

* **Parameters:**
  * **value** (*None*) – the regression value
  * **confidence** (*None*) – a confidence in `[0, 1]` for the regression

**Attributes:**

| [`value`](#fiftyone.core.labels.Regression.value)             | A floating point number field.                                                                                               |
|---------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`confidence`](#fiftyone.core.labels.Regression.confidence)   | A floating point number field.                                                                                               |
| [`STRICT`](#fiftyone.core.labels.Regression.STRICT)           |                                                                                                                              |
| [`field_names`](#fiftyone.core.labels.Regression.field_names) | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.Regression.id)                   | An Object ID field.                                                                                                          |
| [`tags`](#fiftyone.core.labels.Regression.tags)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`clean`](#fiftyone.core.labels.Regression.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.Regression.clear_field)(field_name)                      | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.Regression.copy)()                                              | Returns a deep copy of the document.                                                                       |
| [`delete_attribute`](#fiftyone.core.labels.Regression.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                                 |
| [`fancy_repr`](#fiftyone.core.labels.Regression.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.Regression.field_to_mongo)(field_name)                |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.Regression.field_to_python)(field_name, value)       |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.Regression.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.Regression.from_json)(s)                                   | Loads the document from a JSON string.                                                                     |
| [`get_attribute_value`](#fiftyone.core.labels.Regression.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                       |
| [`get_field`](#fiftyone.core.labels.Regression.get_field)(field_name)                          | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.Regression.get_text_score)()                          | Get text score from text query                                                                             |
| [`has_attribute`](#fiftyone.core.labels.Regression.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                         |
| [`has_field`](#fiftyone.core.labels.Regression.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                             |
| [`iter_attributes`](#fiftyone.core.labels.Regression.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                               |
| [`iter_fields`](#fiftyone.core.labels.Regression.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.Regression.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                              |
| [`set_attribute_value`](#fiftyone.core.labels.Regression.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                       |
| [`set_field`](#fiftyone.core.labels.Regression.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.Regression.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.Regression.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.Regression.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.Regression.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Regression.my_metaclass)   |    |
|-------------------------------------------------------------------|----|

#### value

A floating point number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### confidence

A floating point number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Classification(\*args, \*\*kwargs)

Bases: `_HasID`, [`Label`](#fiftyone.core.labels.Label)

A classification label.

* **Parameters:**
  * **label** (*None*) – the label string
  * **confidence** (*None*) – a confidence in `[0, 1]` for the classification
  * **logits** (*None*) – logits associated with the labels

**Attributes:**

| [`label`](#fiftyone.core.labels.Classification.label)             | A unicode string field.                                                                                                      |
|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`confidence`](#fiftyone.core.labels.Classification.confidence)   | A floating point number field.                                                                                               |
| [`logits`](#fiftyone.core.labels.Classification.logits)           | A one-dimensional array field.                                                                                               |
| [`STRICT`](#fiftyone.core.labels.Classification.STRICT)           |                                                                                                                              |
| [`field_names`](#fiftyone.core.labels.Classification.field_names) | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.Classification.id)                   | An Object ID field.                                                                                                          |
| [`tags`](#fiftyone.core.labels.Classification.tags)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`clean`](#fiftyone.core.labels.Classification.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.Classification.clear_field)(field_name)                      | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.Classification.copy)()                                              | Returns a deep copy of the document.                                                                       |
| [`delete_attribute`](#fiftyone.core.labels.Classification.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                                 |
| [`fancy_repr`](#fiftyone.core.labels.Classification.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.Classification.field_to_mongo)(field_name)                |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.Classification.field_to_python)(field_name, value)       |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.Classification.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.Classification.from_json)(s)                                   | Loads the document from a JSON string.                                                                     |
| [`get_attribute_value`](#fiftyone.core.labels.Classification.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                       |
| [`get_field`](#fiftyone.core.labels.Classification.get_field)(field_name)                          | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.Classification.get_text_score)()                          | Get text score from text query                                                                             |
| [`has_attribute`](#fiftyone.core.labels.Classification.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                         |
| [`has_field`](#fiftyone.core.labels.Classification.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                             |
| [`iter_attributes`](#fiftyone.core.labels.Classification.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                               |
| [`iter_fields`](#fiftyone.core.labels.Classification.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.Classification.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                              |
| [`set_attribute_value`](#fiftyone.core.labels.Classification.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                       |
| [`set_field`](#fiftyone.core.labels.Classification.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.Classification.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.Classification.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.Classification.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.Classification.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Classification.my_metaclass)   |    |
|-----------------------------------------------------------------------|----|

#### label

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### confidence

A floating point number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### logits

A one-dimensional array field.

`VectorField` instances accept numeric lists, tuples, and 1D numpy
array values. The underlying data is serialized and stored in the database
as zlib-compressed bytes generated by `numpy.save` and always retrieved
as a numpy array.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Classifications(\*args, \*\*kwargs)

Bases: `_HasLabelList`, [`Label`](#fiftyone.core.labels.Label)

A list of classifications for an image.

* **Parameters:**
  * **classifications** (*None*) – a list of [`Classification`](#fiftyone.core.labels.Classification) instances
  * **logits** (*None*) – logits associated with the labels

**Attributes:**

| [`classifications`](#fiftyone.core.labels.Classifications.classifications)   | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
|------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`logits`](#fiftyone.core.labels.Classifications.logits)                     | A one-dimensional array field.                                                                                                 |
| [`STRICT`](#fiftyone.core.labels.Classifications.STRICT)                     |                                                                                                                                |
| [`field_names`](#fiftyone.core.labels.Classifications.field_names)           | An ordered tuple of the public fields of this document.                                                                        |

**Methods:**

| [`clean`](#fiftyone.core.labels.Classifications.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.Classifications.clear_field)(field_name)                      | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.Classifications.copy)()                                              | Returns a deep copy of the document.                                                                       |
| [`delete_attribute`](#fiftyone.core.labels.Classifications.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                                 |
| [`fancy_repr`](#fiftyone.core.labels.Classifications.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.Classifications.field_to_mongo)(field_name)                |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.Classifications.field_to_python)(field_name, value)       |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.Classifications.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.Classifications.from_json)(s)                                   | Loads the document from a JSON string.                                                                     |
| [`get_attribute_value`](#fiftyone.core.labels.Classifications.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                       |
| [`get_field`](#fiftyone.core.labels.Classifications.get_field)(field_name)                          | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.Classifications.get_text_score)()                          | Get text score from text query                                                                             |
| [`has_attribute`](#fiftyone.core.labels.Classifications.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                         |
| [`has_field`](#fiftyone.core.labels.Classifications.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                             |
| [`iter_attributes`](#fiftyone.core.labels.Classifications.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                               |
| [`iter_fields`](#fiftyone.core.labels.Classifications.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.Classifications.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                              |
| [`set_attribute_value`](#fiftyone.core.labels.Classifications.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                       |
| [`set_field`](#fiftyone.core.labels.Classifications.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.Classifications.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.Classifications.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.Classifications.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.Classifications.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Classifications.my_metaclass)   |    |
|------------------------------------------------------------------------|----|

#### classifications

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### logits

A one-dimensional array field.

`VectorField` instances accept numeric lists, tuples, and 1D numpy
array values. The underlying data is serialized and stored in the database
as zlib-compressed bytes generated by `numpy.save` and always retrieved
as a numpy array.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Detection(\*args, \*\*kwargs)

Bases: `_HasAttributesDict`, `_HasID`, `_HasMedia`, `_HasInstance`, [`Label`](#fiftyone.core.labels.Label)

An object detection.

This class can represent 2D or 3D objects:

- For [2D objects](../user_guide/using_datasets.md#object-detection), you must provide the
  `bounding_box` parameter, and you can also provide the optional
  `mask` or `mask_path` parameters to represent
  [instance segmentations](../user_guide/using_datasets.md#instance-segmentation)
- For [3D objects](../user_guide/using_datasets.md#d-detections), you must instead provide the
  `location`, `dimensions`, and `rotation` parameters

* **Parameters:**
  * **label** (*None*) – the label string
  * **bounding_box** (*None*) – 

    a list of relative bounding box coordinates in
    `[0, 1]` in the following format (2D only):
    ```default
    [<top-left-x>, <top-left-y>, <width>, <height>]
    ```
  * **mask** (*None*) – an instance segmentation mask for the detection within
    its bounding box, which should be a 2D binary or 0/1 integer numpy
    array (2D only)
  * **mask_path** (*None*) – the absolute path to the instance segmentation image
    on disk, which should be a single-channel PNG image where any
    non-zero values represent the instance’s extent (2D only)
  * **location** (*None*) – the object center `[x, y, z]` in scene coordinates
    (3D only)
  * **dimensions** (*None*) – the object size `[x, y, z]` in scene units
    (3D only)
  * **rotation** (*None*) – the object rotation `[x, y, z]` around its center,
    in `[-pi, pi]` (3D only)
  * **confidence** (*None*) – a confidence in `[0, 1]` for the detection
  * **index** (*None*) – an index for the object
  * **instance** (*None*) – an instance of [`Instance`](#fiftyone.core.labels.Instance) to link this
    detection label to other similar labels
  * **attributes** ( *{}*) – a dict mapping attribute names to [`Attribute`](#fiftyone.core.labels.Attribute)
    instances

**Attributes:**

| [`label`](#fiftyone.core.labels.Detection.label)               | A unicode string field.                                                                                                      |
|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`bounding_box`](#fiftyone.core.labels.Detection.bounding_box) | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`mask`](#fiftyone.core.labels.Detection.mask)                 | An n-dimensional array field.                                                                                                |
| [`mask_path`](#fiftyone.core.labels.Detection.mask_path)       | A unicode string field.                                                                                                      |
| [`confidence`](#fiftyone.core.labels.Detection.confidence)     | A floating point number field.                                                                                               |
| [`index`](#fiftyone.core.labels.Detection.index)               | A 32 bit integer field.                                                                                                      |
| [`has_mask`](#fiftyone.core.labels.Detection.has_mask)         | Whether this instance has a mask.                                                                                            |
| [`STRICT`](#fiftyone.core.labels.Detection.STRICT)             |                                                                                                                              |
| [`attributes`](#fiftyone.core.labels.Detection.attributes)     | A dictionary field that wraps a standard Python dictionary.                                                                  |
| [`field_names`](#fiftyone.core.labels.Detection.field_names)   | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.Detection.id)                     | An Object ID field.                                                                                                          |
| [`instance_id`](#fiftyone.core.labels.Detection.instance_id)   | The label's instance ID, or None if it does not have one.                                                                    |
| [`tags`](#fiftyone.core.labels.Detection.tags)                 | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`get_mask`](#fiftyone.core.labels.Detection.get_mask)()                                         | Returns the detection mask for this instance.                                                                                         |
|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| [`import_mask`](#fiftyone.core.labels.Detection.import_mask)([update])                           | Imports this instance's mask from disk to its [`mask`](#fiftyone.core.labels.Detection.mask) attribute.                               |
| [`export_mask`](#fiftyone.core.labels.Detection.export_mask)(outpath[, update, overwrite_path])  | Exports this instance's mask to the given path.                                                                                       |
| [`to_polyline`](#fiftyone.core.labels.Detection.to_polyline)([tolerance, filled])                | Returns a [`Polyline`](#fiftyone.core.labels.Polyline) representation of this instance.                                               |
| [`to_segmentation`](#fiftyone.core.labels.Detection.to_segmentation)([mask, frame_size, target]) | Returns a [`Segmentation`](#fiftyone.core.labels.Segmentation) representation of this instance.                                       |
| [`to_shapely`](#fiftyone.core.labels.Detection.to_shapely)([frame_size])                         | Returns a Shapely representation of this instance.                                                                                    |
| [`from_mask`](#fiftyone.core.labels.Detection.from_mask)(mask[, label])                          | Creates a [`Detection`](#fiftyone.core.labels.Detection) instance with its `mask` attribute populated from the given full image mask. |
| [`clean`](#fiftyone.core.labels.Detection.clean)()                                               | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                              |
| [`clear_field`](#fiftyone.core.labels.Detection.clear_field)(field_name)                         | Clears the field from the document.                                                                                                   |
| [`copy`](#fiftyone.core.labels.Detection.copy)()                                                 | Returns a deep copy of the document.                                                                                                  |
| [`delete_attribute`](#fiftyone.core.labels.Detection.delete_attribute)(name)                     | Deletes the attribute with the given name.                                                                                            |
| [`fancy_repr`](#fiftyone.core.labels.Detection.fancy_repr)([class_name, select_fields, ...])     | Generates a customizable string representation of the document.                                                                       |
| [`field_to_mongo`](#fiftyone.core.labels.Detection.field_to_mongo)(field_name)                   |                                                                                                                                       |
| [`field_to_python`](#fiftyone.core.labels.Detection.field_to_python)(field_name, value)          |                                                                                                                                       |
| [`from_dict`](#fiftyone.core.labels.Detection.from_dict)(d[, extended])                          | Loads the document from a BSON/JSON dictionary.                                                                                       |
| [`from_json`](#fiftyone.core.labels.Detection.from_json)(s)                                      | Loads the document from a JSON string.                                                                                                |
| [`get_attribute_value`](#fiftyone.core.labels.Detection.get_attribute_value)(name[, default])    | Gets the value of the attribute with the given name.                                                                                  |
| [`get_field`](#fiftyone.core.labels.Detection.get_field)(field_name)                             | Gets the field of the document.                                                                                                       |
| [`get_text_score`](#fiftyone.core.labels.Detection.get_text_score)()                             | Get text score from text query                                                                                                        |
| [`has_attribute`](#fiftyone.core.labels.Detection.has_attribute)(name)                           | Determines whether the label has an attribute with the given name.                                                                    |
| [`has_field`](#fiftyone.core.labels.Detection.has_field)(field_name)                             | Determines whether the document has a field of the given name.                                                                        |
| [`iter_attributes`](#fiftyone.core.labels.Detection.iter_attributes)()                           | Returns an iterator over the custom attributes of the label.                                                                          |
| [`iter_fields`](#fiftyone.core.labels.Detection.iter_fields)()                                   | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                              |
| [`merge`](#fiftyone.core.labels.Detection.merge)(doc[, merge_lists, merge_dicts, overwrite])     | Merges the contents of the given document into this document.                                                                         |
| [`set_attribute_value`](#fiftyone.core.labels.Detection.set_attribute_value)(name, value)        | Sets the value of the attribute with the given name.                                                                                  |
| [`set_field`](#fiftyone.core.labels.Detection.set_field)(field_name, value[, create])            | Sets the value of a field of the document.                                                                                            |
| [`to_dict`](#fiftyone.core.labels.Detection.to_dict)([extended])                                 | Serializes this document to a BSON/JSON dictionary.                                                                                   |
| [`to_json`](#fiftyone.core.labels.Detection.to_json)([pretty_print])                             | Serializes the document to a JSON string.                                                                                             |
| [`to_mongo`](#fiftyone.core.labels.Detection.to_mongo)(\*args, \*\*kwargs)                       | Return as SON data ready for use with MongoDB.                                                                                        |
| [`validate`](#fiftyone.core.labels.Detection.validate)([clean])                                  | Ensure that all fields' values are valid and that required fields are present.                                                        |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Detection.my_metaclass)   |    |
|------------------------------------------------------------------|----|

#### label

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### bounding_box

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### mask

An n-dimensional array field.

`ArrayField` instances accept numpy array values. The underlying
data is serialized and stored in the database as zlib-compressed bytes
generated by `numpy.save` and always retrieved as a numpy array.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### mask_path

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### confidence

A floating point number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### index

A 32 bit integer field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *property* has_mask

Whether this instance has a mask.

#### get_mask()

Returns the detection mask for this instance.

* **Returns:**
  a numpy array, or `None`

#### import_mask(update=False)

Imports this instance’s mask from disk to its [`mask`](#fiftyone.core.labels.Detection.mask)
attribute.

* **Parameters:**
  **update** (*False*) – whether to clear this instance’s [`mask_path`](#fiftyone.core.labels.Detection.mask_path)
  attribute after importing

#### export_mask(outpath, update=False, overwrite_path=False)

Exports this instance’s mask to the given path.

* **Parameters:**
  * **outpath** – the path to write the mask
  * **update** (*False*) – whether to clear this instance’s [`mask`](#fiftyone.core.labels.Detection.mask)
    attribute and set its [`mask_path`](#fiftyone.core.labels.Detection.mask_path) attribute when
    exporting in-database segmentations
  * **overwrite_path** (*False*) – whether to write the in-database
    [`mask`](#fiftyone.core.labels.Detection.mask) to disk even when [`mask_path`](#fiftyone.core.labels.Detection.mask_path) is
    already set

#### to_polyline(tolerance=2, filled=True)

Returns a [`Polyline`](#fiftyone.core.labels.Polyline) representation of this instance.

If the detection has a mask, the returned polyline will trace the
boundary of the mask; otherwise, the polyline will trace the bounding
box itself.

* **Parameters:**
  * **tolerance** (*2*) – a tolerance, in pixels, when generating an
    approximate polyline for the instance mask. Typical values are
    1-3 pixels
  * **filled** (*True*) – whether the polyline should be filled
* **Returns:**
  a [`Polyline`](#fiftyone.core.labels.Polyline)

#### to_segmentation(mask=None, frame_size=None, target=255)

Returns a [`Segmentation`](#fiftyone.core.labels.Segmentation) representation of this instance.

The detection must have an instance mask, i.e., its [`mask`](#fiftyone.core.labels.Detection.mask)
attribute must be populated.

You must provide either `mask` or `frame_size` to use this method.

* **Parameters:**
  * **mask** (*None*) – an optional numpy array to use as an initial mask to
    which to add this object
  * **frame_size** (*None*) – the `(width, height)` of the segmentation
    mask to render. This parameter has no effect if a `mask` is
    provided
  * **target** (*255*) – the pixel value or RGB hex string to use to render
    the object
* **Returns:**
  a [`Segmentation`](#fiftyone.core.labels.Segmentation)

#### to_shapely(frame_size=None)

Returns a Shapely representation of this instance.

* **Parameters:**
  **frame_size** (*None*) – the `(width, height)` of the image. If
  provided, the returned geometry will use absolute coordinates
* **Returns:**
  a `shapely.geometry.polygon.Polygon`

#### *classmethod* from_mask(mask, label=None, \*\*attributes)

Creates a [`Detection`](#fiftyone.core.labels.Detection) instance with its `mask` attribute
populated from the given full image mask.

The instance mask for the object is extracted by computing the bounding
rectangle of the non-zero values in the image mask.

* **Parameters:**
  * **mask** – a boolean or 0/1 numpy array
  * **label** (*None*) – the label string
  * **\*\*attributes** – additional attributes for the [`Detection`](#fiftyone.core.labels.Detection)
* **Returns:**
  a [`Detection`](#fiftyone.core.labels.Detection)

#### STRICT *= False*

#### attributes

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

The specified attribute may either exist in the [`attributes`](#fiftyone.core.labels.Detection.attributes) dict
or as a dynamic attribute.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

The specified attribute may either exist in the [`attributes`](#fiftyone.core.labels.Detection.attributes) dict
or as a dynamic attribute.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

The specified attribute may either exist in the [`attributes`](#fiftyone.core.labels.Detection.attributes) dict
or as a dynamic attribute.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *property* instance_id

The label’s instance ID, or None if it does not have one.

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

Attribute may either exist in the [`attributes`](#fiftyone.core.labels.Detection.attributes) dict or as dynamic
attributes.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

If the specified attribute already exists in the [`attributes`](#fiftyone.core.labels.Detection.attributes)
dict, its value is updated there. Otherwise, the attribute is
set (or created) as a dynamic attribute.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Detections(\*args, \*\*kwargs)

Bases: `_HasLabelList`, [`Label`](#fiftyone.core.labels.Label)

A list of object detections in an image.

* **Parameters:**
  **detections** (*None*) – a list of [`Detection`](#fiftyone.core.labels.Detection) instances

**Attributes:**

| [`detections`](#fiftyone.core.labels.Detections.detections)   | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
|---------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`STRICT`](#fiftyone.core.labels.Detections.STRICT)           |                                                                                                                                |
| [`field_names`](#fiftyone.core.labels.Detections.field_names) | An ordered tuple of the public fields of this document.                                                                        |

**Methods:**

| [`to_polylines`](#fiftyone.core.labels.Detections.to_polylines)([tolerance, filled])                    | Returns a [`Polylines`](#fiftyone.core.labels.Polylines) representation of this instance.                |
|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [`to_segmentation`](#fiftyone.core.labels.Detections.to_segmentation)([mask, frame_size, mask_targets]) | Returns a [`Segmentation`](#fiftyone.core.labels.Segmentation) representation of this instance.          |
| [`clean`](#fiftyone.core.labels.Detections.clean)()                                                     | Hook for doing document level data cleaning (usually validation or assignment) before validation is run. |
| [`clear_field`](#fiftyone.core.labels.Detections.clear_field)(field_name)                               | Clears the field from the document.                                                                      |
| [`copy`](#fiftyone.core.labels.Detections.copy)()                                                       | Returns a deep copy of the document.                                                                     |
| [`delete_attribute`](#fiftyone.core.labels.Detections.delete_attribute)(name)                           | Deletes the attribute with the given name.                                                               |
| [`fancy_repr`](#fiftyone.core.labels.Detections.fancy_repr)([class_name, select_fields, ...])           | Generates a customizable string representation of the document.                                          |
| [`field_to_mongo`](#fiftyone.core.labels.Detections.field_to_mongo)(field_name)                         |                                                                                                          |
| [`field_to_python`](#fiftyone.core.labels.Detections.field_to_python)(field_name, value)                |                                                                                                          |
| [`from_dict`](#fiftyone.core.labels.Detections.from_dict)(d[, extended])                                | Loads the document from a BSON/JSON dictionary.                                                          |
| [`from_json`](#fiftyone.core.labels.Detections.from_json)(s)                                            | Loads the document from a JSON string.                                                                   |
| [`get_attribute_value`](#fiftyone.core.labels.Detections.get_attribute_value)(name[, default])          | Gets the value of the attribute with the given name.                                                     |
| [`get_field`](#fiftyone.core.labels.Detections.get_field)(field_name)                                   | Gets the field of the document.                                                                          |
| [`get_text_score`](#fiftyone.core.labels.Detections.get_text_score)()                                   | Get text score from text query                                                                           |
| [`has_attribute`](#fiftyone.core.labels.Detections.has_attribute)(name)                                 | Determines whether the label has an attribute with the given name.                                       |
| [`has_field`](#fiftyone.core.labels.Detections.has_field)(field_name)                                   | Determines whether the document has a field of the given name.                                           |
| [`iter_attributes`](#fiftyone.core.labels.Detections.iter_attributes)()                                 | Returns an iterator over the custom attributes of the label.                                             |
| [`iter_fields`](#fiftyone.core.labels.Detections.iter_fields)()                                         | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                 |
| [`merge`](#fiftyone.core.labels.Detections.merge)(doc[, merge_lists, merge_dicts, overwrite])           | Merges the contents of the given document into this document.                                            |
| [`set_attribute_value`](#fiftyone.core.labels.Detections.set_attribute_value)(name, value)              | Sets the value of the attribute with the given name.                                                     |
| [`set_field`](#fiftyone.core.labels.Detections.set_field)(field_name, value[, create])                  | Sets the value of a field of the document.                                                               |
| [`to_dict`](#fiftyone.core.labels.Detections.to_dict)([extended])                                       | Serializes this document to a BSON/JSON dictionary.                                                      |
| [`to_json`](#fiftyone.core.labels.Detections.to_json)([pretty_print])                                   | Serializes the document to a JSON string.                                                                |
| [`to_mongo`](#fiftyone.core.labels.Detections.to_mongo)(\*args, \*\*kwargs)                             | Return as SON data ready for use with MongoDB.                                                           |
| [`validate`](#fiftyone.core.labels.Detections.validate)([clean])                                        | Ensure that all fields' values are valid and that required fields are present.                           |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Detections.my_metaclass)   |    |
|-------------------------------------------------------------------|----|

#### detections

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_polylines(tolerance=2, filled=True)

Returns a [`Polylines`](#fiftyone.core.labels.Polylines) representation of this instance.

For detections with masks, the returned polylines will trace the
boundaries of the masks; otherwise, the polylines will trace the
bounding boxes themselves.

* **Parameters:**
  * **tolerance** (*2*) – a tolerance, in pixels, when generating approximate
    polylines for the instance masks. Typical values are 1-3 pixels
  * **filled** (*True*) – whether the polylines should be filled
* **Returns:**
  a [`Polylines`](#fiftyone.core.labels.Polylines)

#### to_segmentation(mask=None, frame_size=None, mask_targets=None)

Returns a [`Segmentation`](#fiftyone.core.labels.Segmentation) representation of this instance.

Only detections with instance masks (i.e., their `mask`
attributes populated) will be rendered.

You must provide either `mask` or `frame_size` to use this method.

* **Parameters:**
  * **mask** (*None*) – an optional array to use as an initial mask to which
    to add objects
  * **frame_size** (*None*) – the `(width, height)` of the segmentation
    mask to render. This parameter has no effect if a `mask` is
    provided
  * **mask_targets** (*None*) – a dict mapping integer pixel values (2D masks)
    or RGB hex strings (3D masks) to label strings defining which
    object classes to render and which pixel values to use for each
    class. If omitted, all objects are rendered with pixel value
    255
* **Returns:**
  a [`Segmentation`](#fiftyone.core.labels.Segmentation)

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Polyline(\*args, \*\*kwargs)

Bases: `_HasAttributesDict`, `_HasID`, `_HasInstance`, [`Label`](#fiftyone.core.labels.Label)

A set of semantically related polylines or polygons.

* **Parameters:**
  * **label** (*None*) – a label for the polyline
  * **points** (*None*) – a list of lists of `(x, y)` points in
    `[0, 1] x [0, 1]` describing the vertices of each shape in the
    polyline
  * **confidence** (*None*) – a confidence in `[0, 1]` for the polyline
  * **index** (*None*) – an index for the polyline
  * **instance** (*None*) – an instance of [`Instance`](#fiftyone.core.labels.Instance) to link this
    polyline label to other similar labels
  * **closed** (*False*) – whether the shapes are closed, i.e., and edge should
    be drawn from the last vertex to the first vertex of each shape
  * **filled** (*False*) – whether the polyline represents polygons, i.e., shapes
    that should be filled when rendering them
  * **attributes** ( *{}*) – a dict mapping attribute names to [`Attribute`](#fiftyone.core.labels.Attribute)
    instances for the polyline

**Attributes:**

| [`label`](#fiftyone.core.labels.Polyline.label)             | A unicode string field.                                                                                                      |
|-------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`points`](#fiftyone.core.labels.Polyline.points)           | A list of lists of `(x, y)` coordinate pairs.                                                                                |
| [`confidence`](#fiftyone.core.labels.Polyline.confidence)   | A floating point number field.                                                                                               |
| [`index`](#fiftyone.core.labels.Polyline.index)             | A 32 bit integer field.                                                                                                      |
| [`closed`](#fiftyone.core.labels.Polyline.closed)           | A boolean field.                                                                                                             |
| [`filled`](#fiftyone.core.labels.Polyline.filled)           | A boolean field.                                                                                                             |
| [`STRICT`](#fiftyone.core.labels.Polyline.STRICT)           |                                                                                                                              |
| [`attributes`](#fiftyone.core.labels.Polyline.attributes)   | A dictionary field that wraps a standard Python dictionary.                                                                  |
| [`field_names`](#fiftyone.core.labels.Polyline.field_names) | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.Polyline.id)                   | An Object ID field.                                                                                                          |
| [`instance_id`](#fiftyone.core.labels.Polyline.instance_id) | The label's instance ID, or None if it does not have one.                                                                    |
| [`tags`](#fiftyone.core.labels.Polyline.tags)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`to_detection`](#fiftyone.core.labels.Polyline.to_detection)([mask_size, frame_size])               | Returns a [`Detection`](#fiftyone.core.labels.Detection) representation of this instance whose bounding box tightly encloses the polyline.    |
|------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| [`to_segmentation`](#fiftyone.core.labels.Polyline.to_segmentation)([mask, frame_size, target, ...]) | Returns a [`Segmentation`](#fiftyone.core.labels.Segmentation) representation of this instance.                                               |
| [`to_shapely`](#fiftyone.core.labels.Polyline.to_shapely)([frame_size, filled])                      | Returns a Shapely representation of this instance.                                                                                            |
| [`from_mask`](#fiftyone.core.labels.Polyline.from_mask)(mask[, label, tolerance])                    | Creates a [`Polyline`](#fiftyone.core.labels.Polyline) instance with polygons describing the non-zero region(s) of the given full image mask. |
| [`from_cuboid`](#fiftyone.core.labels.Polyline.from_cuboid)(vertices[, frame_size, label])           | Constructs a cuboid from its 8 vertices in the format below.                                                                                  |
| [`from_rotated_box`](#fiftyone.core.labels.Polyline.from_rotated_box)(xc, yc, w, h, theta[, ...])    | Constructs a rotated bounding box from its center, dimensions, and rotation.                                                                  |
| [`clean`](#fiftyone.core.labels.Polyline.clean)()                                                    | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                      |
| [`clear_field`](#fiftyone.core.labels.Polyline.clear_field)(field_name)                              | Clears the field from the document.                                                                                                           |
| [`copy`](#fiftyone.core.labels.Polyline.copy)()                                                      | Returns a deep copy of the document.                                                                                                          |
| [`delete_attribute`](#fiftyone.core.labels.Polyline.delete_attribute)(name)                          | Deletes the attribute with the given name.                                                                                                    |
| [`fancy_repr`](#fiftyone.core.labels.Polyline.fancy_repr)([class_name, select_fields, ...])          | Generates a customizable string representation of the document.                                                                               |
| [`field_to_mongo`](#fiftyone.core.labels.Polyline.field_to_mongo)(field_name)                        |                                                                                                                                               |
| [`field_to_python`](#fiftyone.core.labels.Polyline.field_to_python)(field_name, value)               |                                                                                                                                               |
| [`from_dict`](#fiftyone.core.labels.Polyline.from_dict)(d[, extended])                               | Loads the document from a BSON/JSON dictionary.                                                                                               |
| [`from_json`](#fiftyone.core.labels.Polyline.from_json)(s)                                           | Loads the document from a JSON string.                                                                                                        |
| [`get_attribute_value`](#fiftyone.core.labels.Polyline.get_attribute_value)(name[, default])         | Gets the value of the attribute with the given name.                                                                                          |
| [`get_field`](#fiftyone.core.labels.Polyline.get_field)(field_name)                                  | Gets the field of the document.                                                                                                               |
| [`get_text_score`](#fiftyone.core.labels.Polyline.get_text_score)()                                  | Get text score from text query                                                                                                                |
| [`has_attribute`](#fiftyone.core.labels.Polyline.has_attribute)(name)                                | Determines whether the label has an attribute with the given name.                                                                            |
| [`has_field`](#fiftyone.core.labels.Polyline.has_field)(field_name)                                  | Determines whether the document has a field of the given name.                                                                                |
| [`iter_attributes`](#fiftyone.core.labels.Polyline.iter_attributes)()                                | Returns an iterator over the custom attributes of the label.                                                                                  |
| [`iter_fields`](#fiftyone.core.labels.Polyline.iter_fields)()                                        | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                      |
| [`merge`](#fiftyone.core.labels.Polyline.merge)(doc[, merge_lists, merge_dicts, overwrite])          | Merges the contents of the given document into this document.                                                                                 |
| [`set_attribute_value`](#fiftyone.core.labels.Polyline.set_attribute_value)(name, value)             | Sets the value of the attribute with the given name.                                                                                          |
| [`set_field`](#fiftyone.core.labels.Polyline.set_field)(field_name, value[, create])                 | Sets the value of a field of the document.                                                                                                    |
| [`to_dict`](#fiftyone.core.labels.Polyline.to_dict)([extended])                                      | Serializes this document to a BSON/JSON dictionary.                                                                                           |
| [`to_json`](#fiftyone.core.labels.Polyline.to_json)([pretty_print])                                  | Serializes the document to a JSON string.                                                                                                     |
| [`to_mongo`](#fiftyone.core.labels.Polyline.to_mongo)(\*args, \*\*kwargs)                            | Return as SON data ready for use with MongoDB.                                                                                                |
| [`validate`](#fiftyone.core.labels.Polyline.validate)([clean])                                       | Ensure that all fields' values are valid and that required fields are present.                                                                |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Polyline.my_metaclass)   |    |
|-----------------------------------------------------------------|----|

#### label

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### points

A list of lists of `(x, y)` coordinate pairs.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### confidence

A floating point number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### index

A 32 bit integer field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### closed

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### filled

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_detection(mask_size=None, frame_size=None)

Returns a [`Detection`](#fiftyone.core.labels.Detection) representation of this instance whose
bounding box tightly encloses the polyline.

If a `mask_size` is provided, an instance mask of the specified size
encoding the polyline’s shape is included.

Alternatively, if a `frame_size` is provided, the required mask size
is then computed based off of the polyline points and `frame_size`.

* **Parameters:**
  * **mask_size** (*None*) – an optional `(width, height)` at which to
    render an instance mask for the polyline
  * **frame_size** (*None*) – used when no `mask_size` is provided.
    an optional `(width, height)` of the frame containing this
    polyline that is used to compute the required `mask_size`
* **Returns:**
  a [`Detection`](#fiftyone.core.labels.Detection)

#### to_segmentation(mask=None, frame_size=None, target=255, thickness=1)

Returns a [`Segmentation`](#fiftyone.core.labels.Segmentation) representation of this instance.

You must provide either `mask` or `frame_size` to use this method.

* **Parameters:**
  * **mask** (*None*) – an optional numpy array to use as an initial mask to
    which to add objects
  * **frame_size** (*None*) – the `(width, height)` of the segmentation
    mask to render. This parameter has no effect if a `mask` is
    provided
  * **target** (*255*) – the pixel value or RGB hex string to use to render
    the object
  * **thickness** (*1*) – the thickness, in pixels, at which to render
    (non-filled) polylines
* **Returns:**
  a [`Segmentation`](#fiftyone.core.labels.Segmentation)

#### to_shapely(frame_size=None, filled=None)

Returns a Shapely representation of this instance.

The type of geometry returned depends on the number of shapes
([`points`](#fiftyone.core.labels.Polyline.points)) and whether they are polygons or lines
([`filled`](#fiftyone.core.labels.Polyline.filled)).

* **Parameters:**
  * **frame_size** (*None*) – the `(width, height)` of the image. If
    provided, the returned geometry will use absolute coordinates
  * **filled** (*None*) – whether to treat the shape as filled (True) or
    hollow (False) regardless of its [`filled`](#fiftyone.core.labels.Polyline.filled) attribute
* **Returns:**
  - `shapely.geometry.polygon.Polygon`: if [`filled`](#fiftyone.core.labels.Polyline.filled) is True
    and [`points`](#fiftyone.core.labels.Polyline.points) contains a single shape
  - `shapely.geometry.multipolygon.MultiPolygon`: if
    [`filled`](#fiftyone.core.labels.Polyline.filled) is True and [`points`](#fiftyone.core.labels.Polyline.points) contains multiple
    shapes
  - `shapely.geometry.linestring.LineString`: if [`filled`](#fiftyone.core.labels.Polyline.filled)
    is False and [`points`](#fiftyone.core.labels.Polyline.points) contains a single shape
  - `shapely.geometry.multilinestring.MultiLineString`: if
    [`filled`](#fiftyone.core.labels.Polyline.filled) is False and [`points`](#fiftyone.core.labels.Polyline.points) contains multiple
    shapes
* **Return type:**
  one of the following

#### *classmethod* from_mask(mask, label=None, tolerance=2, \*\*attributes)

Creates a [`Polyline`](#fiftyone.core.labels.Polyline) instance with polygons describing the
non-zero region(s) of the given full image mask.

* **Parameters:**
  * **mask** – a boolean or 0/1 numpy array
  * **label** (*None*) – the label string
  * **tolerance** (*2*) – a tolerance, in pixels, when generating approximate
    polygons for each region. Typical values are 1-3 pixels
  * **\*\*attributes** – additional attributes for the [`Polyline`](#fiftyone.core.labels.Polyline)
* **Returns:**
  a [`Polyline`](#fiftyone.core.labels.Polyline)

#### *classmethod* from_cuboid(vertices, frame_size=None, label=None, \*\*attributes)

Constructs a cuboid from its 8 vertices in the format below:

```default
   7--------6
  /|       /|
 / |      / |
3--------2  |
|  4-----|--5
| /      | /
|/       |/
0--------1
```

If a `frame_size` is provided, `vertices` must be absolute pixel
coordinates; otherwise `vertices` should be normalized coordinates in
`[0, 1] x [0, 1]`.

* **Parameters:**
  * **vertices** – a list of 8 `(x, y)` vertices in the above format
  * **frame_size** (*None*) – the `(width, height)` of the frame
  * **label** (*None*) – the label string
  * **\*\*attributes** – additional arguments for the [`Polyline`](#fiftyone.core.labels.Polyline)
* **Returns:**
  a [`Polyline`](#fiftyone.core.labels.Polyline)

#### *classmethod* from_rotated_box(xc, yc, w, h, theta, frame_size=None, label=None, \*\*attributes)

Constructs a rotated bounding box from its center, dimensions, and
rotation.

If a `frame_size` is provided, the provided box coordinates must be
absolute pixel coordinates; otherwise they should be normalized
coordinates in `[0, 1]`. Note that rotations in normalized
coordinates only make sense when the source aspect ratio is square.

* **Parameters:**
  * **xc** – the x-center coordinate
  * **yc** – the y-center coorindate
  * **w** – the box width
  * **y** – the box height
  * **theta** – the counter-clockwise rotation of the box in radians
  * **frame_size** (*None*) – the `(width, height)` of the frame
  * **label** (*None*) – the label string
  * **\*\*attributes** – additional arguments for the [`Polyline`](#fiftyone.core.labels.Polyline)
* **Returns:**
  a [`Polyline`](#fiftyone.core.labels.Polyline)

#### STRICT *= False*

#### attributes

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

The specified attribute may either exist in the [`attributes`](#fiftyone.core.labels.Polyline.attributes) dict
or as a dynamic attribute.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

The specified attribute may either exist in the [`attributes`](#fiftyone.core.labels.Polyline.attributes) dict
or as a dynamic attribute.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

The specified attribute may either exist in the [`attributes`](#fiftyone.core.labels.Polyline.attributes) dict
or as a dynamic attribute.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *property* instance_id

The label’s instance ID, or None if it does not have one.

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

Attribute may either exist in the [`attributes`](#fiftyone.core.labels.Polyline.attributes) dict or as dynamic
attributes.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

If the specified attribute already exists in the [`attributes`](#fiftyone.core.labels.Polyline.attributes)
dict, its value is updated there. Otherwise, the attribute is
set (or created) as a dynamic attribute.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Polylines(\*args, \*\*kwargs)

Bases: `_HasLabelList`, [`Label`](#fiftyone.core.labels.Label)

A list of polylines or polygons in an image.

* **Parameters:**
  **polylines** (*None*) – a list of [`Polyline`](#fiftyone.core.labels.Polyline) instances

**Attributes:**

| [`polylines`](#fiftyone.core.labels.Polylines.polylines)     | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
|--------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`STRICT`](#fiftyone.core.labels.Polylines.STRICT)           |                                                                                                                                |
| [`field_names`](#fiftyone.core.labels.Polylines.field_names) | An ordered tuple of the public fields of this document.                                                                        |

**Methods:**

| [`to_detections`](#fiftyone.core.labels.Polylines.to_detections)([mask_size, frame_size])     | Returns a [`Detections`](#fiftyone.core.labels.Detections) representation of this instance whose bounding boxes tightly enclose the polylines.   |
|-----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [`to_segmentation`](#fiftyone.core.labels.Polylines.to_segmentation)([mask, frame_size, ...]) | Returns a [`Segmentation`](#fiftyone.core.labels.Segmentation) representation of this instance.                                                  |
| [`clean`](#fiftyone.core.labels.Polylines.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                         |
| [`clear_field`](#fiftyone.core.labels.Polylines.clear_field)(field_name)                      | Clears the field from the document.                                                                                                              |
| [`copy`](#fiftyone.core.labels.Polylines.copy)()                                              | Returns a deep copy of the document.                                                                                                             |
| [`delete_attribute`](#fiftyone.core.labels.Polylines.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                                                                       |
| [`fancy_repr`](#fiftyone.core.labels.Polylines.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                                                                  |
| [`field_to_mongo`](#fiftyone.core.labels.Polylines.field_to_mongo)(field_name)                |                                                                                                                                                  |
| [`field_to_python`](#fiftyone.core.labels.Polylines.field_to_python)(field_name, value)       |                                                                                                                                                  |
| [`from_dict`](#fiftyone.core.labels.Polylines.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                                                                  |
| [`from_json`](#fiftyone.core.labels.Polylines.from_json)(s)                                   | Loads the document from a JSON string.                                                                                                           |
| [`get_attribute_value`](#fiftyone.core.labels.Polylines.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                                                             |
| [`get_field`](#fiftyone.core.labels.Polylines.get_field)(field_name)                          | Gets the field of the document.                                                                                                                  |
| [`get_text_score`](#fiftyone.core.labels.Polylines.get_text_score)()                          | Get text score from text query                                                                                                                   |
| [`has_attribute`](#fiftyone.core.labels.Polylines.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                                                               |
| [`has_field`](#fiftyone.core.labels.Polylines.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                                                                   |
| [`iter_attributes`](#fiftyone.core.labels.Polylines.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                                                                     |
| [`iter_fields`](#fiftyone.core.labels.Polylines.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                         |
| [`merge`](#fiftyone.core.labels.Polylines.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                                                                    |
| [`set_attribute_value`](#fiftyone.core.labels.Polylines.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                                                             |
| [`set_field`](#fiftyone.core.labels.Polylines.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                                                                       |
| [`to_dict`](#fiftyone.core.labels.Polylines.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                                                              |
| [`to_json`](#fiftyone.core.labels.Polylines.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                                                        |
| [`to_mongo`](#fiftyone.core.labels.Polylines.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                                                                   |
| [`validate`](#fiftyone.core.labels.Polylines.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                                                                   |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Polylines.my_metaclass)   |    |
|------------------------------------------------------------------|----|

#### polylines

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_detections(mask_size=None, frame_size=None)

Returns a [`Detections`](#fiftyone.core.labels.Detections) representation of this instance whose
bounding boxes tightly enclose the polylines.

If a `mask_size` is provided, instance masks of the specified size
encoding the polyline’s shape are included in each [`Detection`](#fiftyone.core.labels.Detection).

Alternatively, if a `frame_size` is provided, the required mask size
is then computed based off of the polyline points and `frame_size`.

* **Parameters:**
  * **mask_size** (*None*) – an optional `(width, height)` at which to
    render instance masks for the polylines
  * **frame_size** (*None*) – used when no `mask_size` is provided.
    an optional `(width, height)` of the frame containing these
    polylines that is used to compute the required `mask_size`
* **Returns:**
  a [`Detections`](#fiftyone.core.labels.Detections)

#### to_segmentation(mask=None, frame_size=None, mask_targets=None, thickness=1)

Returns a [`Segmentation`](#fiftyone.core.labels.Segmentation) representation of this instance.

You must provide either `mask` or `frame_size` to use this method.

* **Parameters:**
  * **mask** (*None*) – an optional numpy array to use as an initial mask to
    which to add objects
  * **frame_size** (*None*) – the `(width, height)` of the segmentation
    mask to render. This parameter has no effect if a `mask` is
    provided
  * **mask_targets** (*None*) – a dict mapping integer pixel values (2D masks)
    or RGB hex strings (3D masks) to label strings defining which
    object classes to render and which pixel values to use for each
    class. If omitted, all objects are rendered with pixel value
    255
  * **thickness** (*1*) – the thickness, in pixels, at which to render
    (non-filled) polylines
* **Returns:**
  a [`Segmentation`](#fiftyone.core.labels.Segmentation)

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Keypoint(\*args, \*\*kwargs)

Bases: `_HasAttributesDict`, `_HasID`, `_HasInstance`, [`Label`](#fiftyone.core.labels.Label)

A list of keypoints in an image.

* **Parameters:**
  * **label** (*None*) – a label for the points
  * **points** (*None*) – a list of `(x, y)` keypoints in `[0, 1] x [0, 1]`
  * **confidence** (*None*) – a list of confidences in `[0, 1]` for each point
  * **index** (*None*) – an index for the keypoints
  * **instance** (*None*) – an instance of [`Instance`](#fiftyone.core.labels.Instance) to link this
    keypoint label to other similar labels
  * **attributes** ( *{}*) – a dict mapping attribute names to [`Attribute`](#fiftyone.core.labels.Attribute)
    instances

**Attributes:**

| [`label`](#fiftyone.core.labels.Keypoint.label)             | A unicode string field.                                                                                                      |
|-------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`points`](#fiftyone.core.labels.Keypoint.points)           | A list of `(x, y)` coordinate pairs.                                                                                         |
| [`confidence`](#fiftyone.core.labels.Keypoint.confidence)   | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`index`](#fiftyone.core.labels.Keypoint.index)             | A 32 bit integer field.                                                                                                      |
| [`STRICT`](#fiftyone.core.labels.Keypoint.STRICT)           |                                                                                                                              |
| [`attributes`](#fiftyone.core.labels.Keypoint.attributes)   | A dictionary field that wraps a standard Python dictionary.                                                                  |
| [`field_names`](#fiftyone.core.labels.Keypoint.field_names) | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.Keypoint.id)                   | An Object ID field.                                                                                                          |
| [`instance_id`](#fiftyone.core.labels.Keypoint.instance_id) | The label's instance ID, or None if it does not have one.                                                                    |
| [`tags`](#fiftyone.core.labels.Keypoint.tags)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`to_shapely`](#fiftyone.core.labels.Keypoint.to_shapely)([frame_size])                                      | Returns a Shapely representation of this instance.                                                       |
|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [`apply_confidence_threshold`](#fiftyone.core.labels.Keypoint.apply_confidence_threshold)(confidence_thresh) | Replaces all `points` on this instance whose confidence are below the provided threshold with `np.nan`.  |
| [`clean`](#fiftyone.core.labels.Keypoint.clean)()                                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run. |
| [`clear_field`](#fiftyone.core.labels.Keypoint.clear_field)(field_name)                                      | Clears the field from the document.                                                                      |
| [`copy`](#fiftyone.core.labels.Keypoint.copy)()                                                              | Returns a deep copy of the document.                                                                     |
| [`delete_attribute`](#fiftyone.core.labels.Keypoint.delete_attribute)(name)                                  | Deletes the attribute with the given name.                                                               |
| [`fancy_repr`](#fiftyone.core.labels.Keypoint.fancy_repr)([class_name, select_fields, ...])                  | Generates a customizable string representation of the document.                                          |
| [`field_to_mongo`](#fiftyone.core.labels.Keypoint.field_to_mongo)(field_name)                                |                                                                                                          |
| [`field_to_python`](#fiftyone.core.labels.Keypoint.field_to_python)(field_name, value)                       |                                                                                                          |
| [`from_dict`](#fiftyone.core.labels.Keypoint.from_dict)(d[, extended])                                       | Loads the document from a BSON/JSON dictionary.                                                          |
| [`from_json`](#fiftyone.core.labels.Keypoint.from_json)(s)                                                   | Loads the document from a JSON string.                                                                   |
| [`get_attribute_value`](#fiftyone.core.labels.Keypoint.get_attribute_value)(name[, default])                 | Gets the value of the attribute with the given name.                                                     |
| [`get_field`](#fiftyone.core.labels.Keypoint.get_field)(field_name)                                          | Gets the field of the document.                                                                          |
| [`get_text_score`](#fiftyone.core.labels.Keypoint.get_text_score)()                                          | Get text score from text query                                                                           |
| [`has_attribute`](#fiftyone.core.labels.Keypoint.has_attribute)(name)                                        | Determines whether the label has an attribute with the given name.                                       |
| [`has_field`](#fiftyone.core.labels.Keypoint.has_field)(field_name)                                          | Determines whether the document has a field of the given name.                                           |
| [`iter_attributes`](#fiftyone.core.labels.Keypoint.iter_attributes)()                                        | Returns an iterator over the custom attributes of the label.                                             |
| [`iter_fields`](#fiftyone.core.labels.Keypoint.iter_fields)()                                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                 |
| [`merge`](#fiftyone.core.labels.Keypoint.merge)(doc[, merge_lists, merge_dicts, overwrite])                  | Merges the contents of the given document into this document.                                            |
| [`set_attribute_value`](#fiftyone.core.labels.Keypoint.set_attribute_value)(name, value)                     | Sets the value of the attribute with the given name.                                                     |
| [`set_field`](#fiftyone.core.labels.Keypoint.set_field)(field_name, value[, create])                         | Sets the value of a field of the document.                                                               |
| [`to_dict`](#fiftyone.core.labels.Keypoint.to_dict)([extended])                                              | Serializes this document to a BSON/JSON dictionary.                                                      |
| [`to_json`](#fiftyone.core.labels.Keypoint.to_json)([pretty_print])                                          | Serializes the document to a JSON string.                                                                |
| [`to_mongo`](#fiftyone.core.labels.Keypoint.to_mongo)(\*args, \*\*kwargs)                                    | Return as SON data ready for use with MongoDB.                                                           |
| [`validate`](#fiftyone.core.labels.Keypoint.validate)([clean])                                               | Ensure that all fields' values are valid and that required fields are present.                           |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Keypoint.my_metaclass)   |    |
|-----------------------------------------------------------------|----|

#### label

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### points

A list of `(x, y)` coordinate pairs.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### confidence

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### index

A 32 bit integer field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_shapely(frame_size=None)

Returns a Shapely representation of this instance.

* **Parameters:**
  **frame_size** (*None*) – the `(width, height)` of the image. If
  provided, the returned geometry will use absolute coordinates
* **Returns:**
  a `shapely.geometry.multipoint.MultiPoint`

#### apply_confidence_threshold(confidence_thresh)

Replaces all `points` on this instance whose confidence are below
the provided threshold with `np.nan`.

Use
`filter_keypoints <fiftyone.core.collections.SampleCollection.filter_keypoints()`
to perform this operation as temporary view rather than a permanent
data transformation.

* **Parameters:**
  **confidence_thresh** – a confidence threshold

#### STRICT *= False*

#### attributes

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

The specified attribute may either exist in the [`attributes`](#fiftyone.core.labels.Keypoint.attributes) dict
or as a dynamic attribute.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

The specified attribute may either exist in the [`attributes`](#fiftyone.core.labels.Keypoint.attributes) dict
or as a dynamic attribute.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

The specified attribute may either exist in the [`attributes`](#fiftyone.core.labels.Keypoint.attributes) dict
or as a dynamic attribute.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *property* instance_id

The label’s instance ID, or None if it does not have one.

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

Attribute may either exist in the [`attributes`](#fiftyone.core.labels.Keypoint.attributes) dict or as dynamic
attributes.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

If the specified attribute already exists in the [`attributes`](#fiftyone.core.labels.Keypoint.attributes)
dict, its value is updated there. Otherwise, the attribute is
set (or created) as a dynamic attribute.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Keypoints(\*args, \*\*kwargs)

Bases: `_HasLabelList`, [`Label`](#fiftyone.core.labels.Label)

A list of [`Keypoint`](#fiftyone.core.labels.Keypoint) instances in an image.

* **Parameters:**
  **keypoints** (*None*) – a list of [`Keypoint`](#fiftyone.core.labels.Keypoint) instances

**Attributes:**

| [`keypoints`](#fiftyone.core.labels.Keypoints.keypoints)     | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
|--------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`STRICT`](#fiftyone.core.labels.Keypoints.STRICT)           |                                                                                                                                |
| [`field_names`](#fiftyone.core.labels.Keypoints.field_names) | An ordered tuple of the public fields of this document.                                                                        |

**Methods:**

| [`clean`](#fiftyone.core.labels.Keypoints.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|-----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.Keypoints.clear_field)(field_name)                      | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.Keypoints.copy)()                                              | Returns a deep copy of the document.                                                                       |
| [`delete_attribute`](#fiftyone.core.labels.Keypoints.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                                 |
| [`fancy_repr`](#fiftyone.core.labels.Keypoints.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.Keypoints.field_to_mongo)(field_name)                |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.Keypoints.field_to_python)(field_name, value)       |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.Keypoints.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.Keypoints.from_json)(s)                                   | Loads the document from a JSON string.                                                                     |
| [`get_attribute_value`](#fiftyone.core.labels.Keypoints.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                       |
| [`get_field`](#fiftyone.core.labels.Keypoints.get_field)(field_name)                          | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.Keypoints.get_text_score)()                          | Get text score from text query                                                                             |
| [`has_attribute`](#fiftyone.core.labels.Keypoints.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                         |
| [`has_field`](#fiftyone.core.labels.Keypoints.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                             |
| [`iter_attributes`](#fiftyone.core.labels.Keypoints.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                               |
| [`iter_fields`](#fiftyone.core.labels.Keypoints.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.Keypoints.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                              |
| [`set_attribute_value`](#fiftyone.core.labels.Keypoints.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                       |
| [`set_field`](#fiftyone.core.labels.Keypoints.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.Keypoints.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.Keypoints.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.Keypoints.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.Keypoints.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Keypoints.my_metaclass)   |    |
|------------------------------------------------------------------|----|

#### keypoints

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Segmentation(\*args, \*\*kwargs)

Bases: `_HasID`, `_HasMedia`, [`Label`](#fiftyone.core.labels.Label)

A semantic segmentation for an image.

Provide either the `mask` or `mask_path` argument to define the
segmentation.

* **Parameters:**
  * **mask** (*None*) – a numpy array with integer values encoding the semantic
    labels
  * **mask_path** (*None*) – the absolute path to the segmentation image on disk

**Attributes:**

| [`mask`](#fiftyone.core.labels.Segmentation.mask)               | An n-dimensional array field.                                                                                                |
|-----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`mask_path`](#fiftyone.core.labels.Segmentation.mask_path)     | A unicode string field.                                                                                                      |
| [`has_mask`](#fiftyone.core.labels.Segmentation.has_mask)       | Whether this instance has a mask.                                                                                            |
| [`STRICT`](#fiftyone.core.labels.Segmentation.STRICT)           |                                                                                                                              |
| [`field_names`](#fiftyone.core.labels.Segmentation.field_names) | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.Segmentation.id)                   | An Object ID field.                                                                                                          |
| [`tags`](#fiftyone.core.labels.Segmentation.tags)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`get_mask`](#fiftyone.core.labels.Segmentation.get_mask)()                                           | Returns the segmentation mask for this instance.                                                                          |
|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| [`import_mask`](#fiftyone.core.labels.Segmentation.import_mask)([update])                             | Imports this instance's mask from disk to its [`mask`](#fiftyone.core.labels.Segmentation.mask) attribute.                |
| [`export_mask`](#fiftyone.core.labels.Segmentation.export_mask)(outpath[, update, overwrite_path])    | Exports this instance's mask to the given path.                                                                           |
| [`transform_mask`](#fiftyone.core.labels.Segmentation.transform_mask)(targets_map[, outpath, update]) | Transforms this instance's mask according to the provided targets map.                                                    |
| [`to_detections`](#fiftyone.core.labels.Segmentation.to_detections)([mask_targets, mask_types])       | Returns a [`Detections`](#fiftyone.core.labels.Detections) representation of this instance with instance masks populated. |
| [`to_polylines`](#fiftyone.core.labels.Segmentation.to_polylines)([mask_targets, mask_types, ...])    | Returns a [`Polylines`](#fiftyone.core.labels.Polylines) representation of this instance.                                 |
| [`clean`](#fiftyone.core.labels.Segmentation.clean)()                                                 | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                  |
| [`clear_field`](#fiftyone.core.labels.Segmentation.clear_field)(field_name)                           | Clears the field from the document.                                                                                       |
| [`copy`](#fiftyone.core.labels.Segmentation.copy)()                                                   | Returns a deep copy of the document.                                                                                      |
| [`delete_attribute`](#fiftyone.core.labels.Segmentation.delete_attribute)(name)                       | Deletes the attribute with the given name.                                                                                |
| [`fancy_repr`](#fiftyone.core.labels.Segmentation.fancy_repr)([class_name, select_fields, ...])       | Generates a customizable string representation of the document.                                                           |
| [`field_to_mongo`](#fiftyone.core.labels.Segmentation.field_to_mongo)(field_name)                     |                                                                                                                           |
| [`field_to_python`](#fiftyone.core.labels.Segmentation.field_to_python)(field_name, value)            |                                                                                                                           |
| [`from_dict`](#fiftyone.core.labels.Segmentation.from_dict)(d[, extended])                            | Loads the document from a BSON/JSON dictionary.                                                                           |
| [`from_json`](#fiftyone.core.labels.Segmentation.from_json)(s)                                        | Loads the document from a JSON string.                                                                                    |
| [`get_attribute_value`](#fiftyone.core.labels.Segmentation.get_attribute_value)(name[, default])      | Gets the value of the attribute with the given name.                                                                      |
| [`get_field`](#fiftyone.core.labels.Segmentation.get_field)(field_name)                               | Gets the field of the document.                                                                                           |
| [`get_text_score`](#fiftyone.core.labels.Segmentation.get_text_score)()                               | Get text score from text query                                                                                            |
| [`has_attribute`](#fiftyone.core.labels.Segmentation.has_attribute)(name)                             | Determines whether the label has an attribute with the given name.                                                        |
| [`has_field`](#fiftyone.core.labels.Segmentation.has_field)(field_name)                               | Determines whether the document has a field of the given name.                                                            |
| [`iter_attributes`](#fiftyone.core.labels.Segmentation.iter_attributes)()                             | Returns an iterator over the custom attributes of the label.                                                              |
| [`iter_fields`](#fiftyone.core.labels.Segmentation.iter_fields)()                                     | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                  |
| [`merge`](#fiftyone.core.labels.Segmentation.merge)(doc[, merge_lists, merge_dicts, overwrite])       | Merges the contents of the given document into this document.                                                             |
| [`set_attribute_value`](#fiftyone.core.labels.Segmentation.set_attribute_value)(name, value)          | Sets the value of the attribute with the given name.                                                                      |
| [`set_field`](#fiftyone.core.labels.Segmentation.set_field)(field_name, value[, create])              | Sets the value of a field of the document.                                                                                |
| [`to_dict`](#fiftyone.core.labels.Segmentation.to_dict)([extended])                                   | Serializes this document to a BSON/JSON dictionary.                                                                       |
| [`to_json`](#fiftyone.core.labels.Segmentation.to_json)([pretty_print])                               | Serializes the document to a JSON string.                                                                                 |
| [`to_mongo`](#fiftyone.core.labels.Segmentation.to_mongo)(\*args, \*\*kwargs)                         | Return as SON data ready for use with MongoDB.                                                                            |
| [`validate`](#fiftyone.core.labels.Segmentation.validate)([clean])                                    | Ensure that all fields' values are valid and that required fields are present.                                            |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Segmentation.my_metaclass)   |    |
|---------------------------------------------------------------------|----|

#### mask

An n-dimensional array field.

`ArrayField` instances accept numpy array values. The underlying
data is serialized and stored in the database as zlib-compressed bytes
generated by `numpy.save` and always retrieved as a numpy array.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### mask_path

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *property* has_mask

Whether this instance has a mask.

#### get_mask()

Returns the segmentation mask for this instance.

* **Returns:**
  a numpy array, or `None`

#### import_mask(update=False)

Imports this instance’s mask from disk to its [`mask`](#fiftyone.core.labels.Segmentation.mask)
attribute.

* **Parameters:**
  **update** (*False*) – whether to clear this instance’s [`mask_path`](#fiftyone.core.labels.Segmentation.mask_path)
  attribute after importing

#### export_mask(outpath, update=False, overwrite_path=False)

Exports this instance’s mask to the given path.

* **Parameters:**
  * **outpath** – the path to write the mask
  * **update** (*False*) – whether to clear this instance’s [`mask`](#fiftyone.core.labels.Segmentation.mask)
    attribute and set its [`mask_path`](#fiftyone.core.labels.Segmentation.mask_path) attribute when
    exporting in-database segmentations
  * **overwrite_path** (*False*) – whether to write the in-database
    [`mask`](#fiftyone.core.labels.Segmentation.mask) to disk even when [`mask_path`](#fiftyone.core.labels.Segmentation.mask_path) is
    already set

#### transform_mask(targets_map, outpath=None, update=False)

Transforms this instance’s mask according to the provided targets
map.

This method can be used to transform between grayscale and RGB masks,
or it can be used to edit the pixel values or colors of a mask without
changing the number of channels.

Note that any pixel values not in `targets_map` will be zero in the
transformed mask.

* **Parameters:**
  * **targets_map** – a dict mapping existing pixel values (2D masks) or RGB
    hex strings (3D masks) to new pixel values or RGB hex strings.
    You may convert between grayscale and RGB using this argument
  * **outpath** (*None*) – an optional path to write the transformed mask on
    disk
  * **update** (*False*) – whether to save the transformed mask on this
    instance
* **Returns:**
  the transformed mask

#### to_detections(mask_targets=None, mask_types='stuff')

Returns a [`Detections`](#fiftyone.core.labels.Detections) representation of this instance with
instance masks populated.

Each `"stuff"` class will be converted to a single [`Detection`](#fiftyone.core.labels.Detection)
whose instance mask spans all region(s) of the class.

Each `"thing"` class will result in one [`Detection`](#fiftyone.core.labels.Detection) instance
per connected region of that class in the segmentation.

* **Parameters:**
  * **mask_targets** (*None*) – a dict mapping integer pixel values (2D masks)
    or RGB hex strings (3D masks) to label strings defining which
    classes to generate detections for. If omitted, all labels are
    assigned to their pixel values
  * **mask_types** ( *"stuff"*) – 

    whether the classes are `"stuff"`
    (amorphous regions of pixels) or `"thing"` (connected
    regions, each representing an instance of the thing). Can be
    any of the following:
    - `"stuff"` if all classes are stuff classes
    - `"thing"` if all classes are thing classes
    - a dict mapping pixel values (2D masks) or RGB hex strings
      (3D masks) to `"stuff"` or `"thing"` for each class
* **Returns:**
  a [`Detections`](#fiftyone.core.labels.Detections)

#### to_polylines(mask_targets=None, mask_types='stuff', tolerance=2)

Returns a [`Polylines`](#fiftyone.core.labels.Polylines) representation of this instance.

Each `"stuff"` class will be converted to a single [`Polyline`](#fiftyone.core.labels.Polyline)
that may contain multiple disjoint shapes capturing the class.

Each `"thing"` class will result in one [`Polyline`](#fiftyone.core.labels.Polyline) instance
per connected region of that class.

* **Parameters:**
  * **mask_targets** (*None*) – a dict mapping integer pixel values (2D masks)
    or RGB hex strings (3D masks) to label strings defining which
    classes to generate detections for. If omitted, all labels are
    assigned to their pixel values
  * **mask_types** ( *"stuff"*) – 

    whether the classes are `"stuff"`
    (amorphous regions of pixels) or `"thing"` (connected
    regions, each representing an instance of the thing). Can be
    any of the following:
    - `"stuff"` if all classes are stuff classes
    - `"thing"` if all classes are thing classes
    - a dict mapping pixel values (2D masks) or RGB hex strings
      (3D masks) to `"stuff"` or `"thing"` for each class
  * **tolerance** (*2*) – a tolerance, in pixels, when generating approximate
    polylines for each region. Typical values are 1-3 pixels
* **Returns:**
  a [`Polylines`](#fiftyone.core.labels.Polylines)

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.Heatmap(\*args, \*\*kwargs)

Bases: `_HasID`, `_HasMedia`, [`Label`](#fiftyone.core.labels.Label)

A heatmap for an image.

Provide either the `map` or `map_path` argument to define the heatmap.

* **Parameters:**
  * **map** (*None*) – a 2D numpy array
  * **map_path** (*None*) – the absolute path to the heatmap image on disk
  * **range** (*None*) – an optional `[min, max]` range of the map’s values. If
    None is provided, `[0, 1]` will be assumed if `map` contains
    floating point values, `[0, 255]` will be assumed if `map`
    contains integer values, and the dtype of the image will be assumed
    if `map_path` is used

**Attributes:**

| [`map`](#fiftyone.core.labels.Heatmap.map)                 | An n-dimensional array field.                                                                                                |
|------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`map_path`](#fiftyone.core.labels.Heatmap.map_path)       | A unicode string field.                                                                                                      |
| [`range`](#fiftyone.core.labels.Heatmap.range)             | A `[min, max]` range of the values in a [`fiftyone.core.labels.Heatmap`](#fiftyone.core.labels.Heatmap).                     |
| [`has_map`](#fiftyone.core.labels.Heatmap.has_map)         | Whether this instance has a map.                                                                                             |
| [`STRICT`](#fiftyone.core.labels.Heatmap.STRICT)           |                                                                                                                              |
| [`field_names`](#fiftyone.core.labels.Heatmap.field_names) | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.Heatmap.id)                   | An Object ID field.                                                                                                          |
| [`tags`](#fiftyone.core.labels.Heatmap.tags)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`get_map`](#fiftyone.core.labels.Heatmap.get_map)()                                        | Returns the map array for this instance.                                                                 |
|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [`import_map`](#fiftyone.core.labels.Heatmap.import_map)([update])                          | Imports this instance's map from disk to its [`map`](#fiftyone.core.labels.Heatmap.map) attribute.       |
| [`export_map`](#fiftyone.core.labels.Heatmap.export_map)(outpath[, update])                 | Exports this instance's map to the given path.                                                           |
| [`clean`](#fiftyone.core.labels.Heatmap.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run. |
| [`clear_field`](#fiftyone.core.labels.Heatmap.clear_field)(field_name)                      | Clears the field from the document.                                                                      |
| [`copy`](#fiftyone.core.labels.Heatmap.copy)()                                              | Returns a deep copy of the document.                                                                     |
| [`delete_attribute`](#fiftyone.core.labels.Heatmap.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                               |
| [`fancy_repr`](#fiftyone.core.labels.Heatmap.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                          |
| [`field_to_mongo`](#fiftyone.core.labels.Heatmap.field_to_mongo)(field_name)                |                                                                                                          |
| [`field_to_python`](#fiftyone.core.labels.Heatmap.field_to_python)(field_name, value)       |                                                                                                          |
| [`from_dict`](#fiftyone.core.labels.Heatmap.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                          |
| [`from_json`](#fiftyone.core.labels.Heatmap.from_json)(s)                                   | Loads the document from a JSON string.                                                                   |
| [`get_attribute_value`](#fiftyone.core.labels.Heatmap.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                     |
| [`get_field`](#fiftyone.core.labels.Heatmap.get_field)(field_name)                          | Gets the field of the document.                                                                          |
| [`get_text_score`](#fiftyone.core.labels.Heatmap.get_text_score)()                          | Get text score from text query                                                                           |
| [`has_attribute`](#fiftyone.core.labels.Heatmap.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                       |
| [`has_field`](#fiftyone.core.labels.Heatmap.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                           |
| [`iter_attributes`](#fiftyone.core.labels.Heatmap.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                             |
| [`iter_fields`](#fiftyone.core.labels.Heatmap.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                 |
| [`merge`](#fiftyone.core.labels.Heatmap.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                            |
| [`set_attribute_value`](#fiftyone.core.labels.Heatmap.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                     |
| [`set_field`](#fiftyone.core.labels.Heatmap.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                               |
| [`to_dict`](#fiftyone.core.labels.Heatmap.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                      |
| [`to_json`](#fiftyone.core.labels.Heatmap.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                |
| [`to_mongo`](#fiftyone.core.labels.Heatmap.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                           |
| [`validate`](#fiftyone.core.labels.Heatmap.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                           |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.Heatmap.my_metaclass)   |    |
|----------------------------------------------------------------|----|

#### map

An n-dimensional array field.

`ArrayField` instances accept numpy array values. The underlying
data is serialized and stored in the database as zlib-compressed bytes
generated by `numpy.save` and always retrieved as a numpy array.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### map_path

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### range

A `[min, max]` range of the values in a
[`fiftyone.core.labels.Heatmap`](#fiftyone.core.labels.Heatmap).

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *property* has_map

Whether this instance has a map.

#### get_map()

Returns the map array for this instance.

* **Returns:**
  a numpy array, or `None`

#### import_map(update=False)

Imports this instance’s map from disk to its [`map`](#fiftyone.core.labels.Heatmap.map) attribute.

* **Parameters:**
  * **outpath** – the path to write the map
  * **update** (*False*) – whether to clear this instance’s [`map_path`](#fiftyone.core.labels.Heatmap.map_path)
    attribute after importing

#### export_map(outpath, update=False)

Exports this instance’s map to the given path.

* **Parameters:**
  * **outpath** – the path to write the map
  * **update** (*False*) – whether to clear this instance’s [`map`](#fiftyone.core.labels.Heatmap.map) and
    [`range`](#fiftyone.core.labels.Heatmap.range) attributes and set its [`map_path`](#fiftyone.core.labels.Heatmap.map_path) attribute
    when exporting in-database heatmaps

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.TemporalDetection(\*args, \*\*kwargs)

Bases: `_HasID`, [`Label`](#fiftyone.core.labels.Label)

A temporal detection in a video whose support is defined by a start and
end frame.

* **Parameters:**
  * **label** (*None*) – the label string
  * **support** (*None*) – the `[first, last]` frame numbers, inclusive
  * **confidence** (*None*) – a confidence in `[0, 1]` for the detection

**Attributes:**

| [`label`](#fiftyone.core.labels.TemporalDetection.label)             | A unicode string field.                                                                                                      |
|----------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`support`](#fiftyone.core.labels.TemporalDetection.support)         | A `[first, last]` frame support in a video.                                                                                  |
| [`confidence`](#fiftyone.core.labels.TemporalDetection.confidence)   | A floating point number field.                                                                                               |
| [`STRICT`](#fiftyone.core.labels.TemporalDetection.STRICT)           |                                                                                                                              |
| [`field_names`](#fiftyone.core.labels.TemporalDetection.field_names) | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.TemporalDetection.id)                   | An Object ID field.                                                                                                          |
| [`tags`](#fiftyone.core.labels.TemporalDetection.tags)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`from_timestamps`](#fiftyone.core.labels.TemporalDetection.from_timestamps)(timestamps[, sample, metadata])   | Creates a [`TemporalDetection`](#fiftyone.core.labels.TemporalDetection) instance from `[start, stop]` timestamps for the specified video.   |
|----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| [`to_timestamps`](#fiftyone.core.labels.TemporalDetection.to_timestamps)([sample, metadata])                   | Returns the `[start, stop]` timestamps, in seconds, for this temporal detection in the given video.                                          |
| [`clean`](#fiftyone.core.labels.TemporalDetection.clean)()                                                     | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                     |
| [`clear_field`](#fiftyone.core.labels.TemporalDetection.clear_field)(field_name)                               | Clears the field from the document.                                                                                                          |
| [`copy`](#fiftyone.core.labels.TemporalDetection.copy)()                                                       | Returns a deep copy of the document.                                                                                                         |
| [`delete_attribute`](#fiftyone.core.labels.TemporalDetection.delete_attribute)(name)                           | Deletes the attribute with the given name.                                                                                                   |
| [`fancy_repr`](#fiftyone.core.labels.TemporalDetection.fancy_repr)([class_name, select_fields, ...])           | Generates a customizable string representation of the document.                                                                              |
| [`field_to_mongo`](#fiftyone.core.labels.TemporalDetection.field_to_mongo)(field_name)                         |                                                                                                                                              |
| [`field_to_python`](#fiftyone.core.labels.TemporalDetection.field_to_python)(field_name, value)                |                                                                                                                                              |
| [`from_dict`](#fiftyone.core.labels.TemporalDetection.from_dict)(d[, extended])                                | Loads the document from a BSON/JSON dictionary.                                                                                              |
| [`from_json`](#fiftyone.core.labels.TemporalDetection.from_json)(s)                                            | Loads the document from a JSON string.                                                                                                       |
| [`get_attribute_value`](#fiftyone.core.labels.TemporalDetection.get_attribute_value)(name[, default])          | Gets the value of the attribute with the given name.                                                                                         |
| [`get_field`](#fiftyone.core.labels.TemporalDetection.get_field)(field_name)                                   | Gets the field of the document.                                                                                                              |
| [`get_text_score`](#fiftyone.core.labels.TemporalDetection.get_text_score)()                                   | Get text score from text query                                                                                                               |
| [`has_attribute`](#fiftyone.core.labels.TemporalDetection.has_attribute)(name)                                 | Determines whether the label has an attribute with the given name.                                                                           |
| [`has_field`](#fiftyone.core.labels.TemporalDetection.has_field)(field_name)                                   | Determines whether the document has a field of the given name.                                                                               |
| [`iter_attributes`](#fiftyone.core.labels.TemporalDetection.iter_attributes)()                                 | Returns an iterator over the custom attributes of the label.                                                                                 |
| [`iter_fields`](#fiftyone.core.labels.TemporalDetection.iter_fields)()                                         | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                     |
| [`merge`](#fiftyone.core.labels.TemporalDetection.merge)(doc[, merge_lists, merge_dicts, overwrite])           | Merges the contents of the given document into this document.                                                                                |
| [`set_attribute_value`](#fiftyone.core.labels.TemporalDetection.set_attribute_value)(name, value)              | Sets the value of the attribute with the given name.                                                                                         |
| [`set_field`](#fiftyone.core.labels.TemporalDetection.set_field)(field_name, value[, create])                  | Sets the value of a field of the document.                                                                                                   |
| [`to_dict`](#fiftyone.core.labels.TemporalDetection.to_dict)([extended])                                       | Serializes this document to a BSON/JSON dictionary.                                                                                          |
| [`to_json`](#fiftyone.core.labels.TemporalDetection.to_json)([pretty_print])                                   | Serializes the document to a JSON string.                                                                                                    |
| [`to_mongo`](#fiftyone.core.labels.TemporalDetection.to_mongo)(\*args, \*\*kwargs)                             | Return as SON data ready for use with MongoDB.                                                                                               |
| [`validate`](#fiftyone.core.labels.TemporalDetection.validate)([clean])                                        | Ensure that all fields' values are valid and that required fields are present.                                                               |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.TemporalDetection.my_metaclass)   |    |
|--------------------------------------------------------------------------|----|

#### label

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### support

A `[first, last]` frame support in a video.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### confidence

A floating point number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *classmethod* from_timestamps(timestamps, sample=None, metadata=None, \*\*kwargs)

Creates a [`TemporalDetection`](#fiftyone.core.labels.TemporalDetection) instance from `[start, stop]`
timestamps for the specified video.

You must provide either `sample` or `metadata` to inform the
conversion.

* **Parameters:**
  * **timestamps** – the `[start, stop]` timestamps, in seconds or
    “HH:MM:SS.XXX” format
  * **sample** (*None*) – a video [`fiftyone.core.sample.Sample`](fiftyone.core.sample.md#fiftyone.core.sample.Sample) whose
    `metadata` field is populated
  * **metadata** (*None*) – a [`fiftyone.core.metadata.VideoMetadata`](fiftyone.core.metadata.md#fiftyone.core.metadata.VideoMetadata)
    instance
  * **\*\*kwargs** – additional arguments for [`TemporalDetection`](#fiftyone.core.labels.TemporalDetection)
* **Returns:**
  a [`TemporalDetection`](#fiftyone.core.labels.TemporalDetection)

#### to_timestamps(sample=None, metadata=None)

Returns the `[start, stop]` timestamps, in seconds, for this
temporal detection in the given video.

You must provide either `sample` or `metadata` to inform the
conversion.

* **Parameters:**
  * **sample** (*None*) – a video [`fiftyone.core.sample.Sample`](fiftyone.core.sample.md#fiftyone.core.sample.Sample) whose
    `metadata` field is populated
  * **metadata** (*None*) – a [`fiftyone.core.metadata.VideoMetadata`](fiftyone.core.metadata.md#fiftyone.core.metadata.VideoMetadata)
    instance
* **Returns:**
  the `[start, stop]` timestamps of this detection, in seconds

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.TemporalDetections(\*args, \*\*kwargs)

Bases: `_HasLabelList`, [`Label`](#fiftyone.core.labels.Label)

A list of temporal detections for a video.

* **Parameters:**
  **detections** (*None*) – a list of [`TemporalDetection`](#fiftyone.core.labels.TemporalDetection)
  instances

**Attributes:**

| [`detections`](#fiftyone.core.labels.TemporalDetections.detections)   | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
|-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`STRICT`](#fiftyone.core.labels.TemporalDetections.STRICT)           |                                                                                                                                |
| [`field_names`](#fiftyone.core.labels.TemporalDetections.field_names) | An ordered tuple of the public fields of this document.                                                                        |

**Methods:**

| [`clean`](#fiftyone.core.labels.TemporalDetections.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.labels.TemporalDetections.clear_field)(field_name)                      | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.labels.TemporalDetections.copy)()                                              | Returns a deep copy of the document.                                                                       |
| [`delete_attribute`](#fiftyone.core.labels.TemporalDetections.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                                 |
| [`fancy_repr`](#fiftyone.core.labels.TemporalDetections.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.labels.TemporalDetections.field_to_mongo)(field_name)                |                                                                                                            |
| [`field_to_python`](#fiftyone.core.labels.TemporalDetections.field_to_python)(field_name, value)       |                                                                                                            |
| [`from_dict`](#fiftyone.core.labels.TemporalDetections.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.labels.TemporalDetections.from_json)(s)                                   | Loads the document from a JSON string.                                                                     |
| [`get_attribute_value`](#fiftyone.core.labels.TemporalDetections.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                       |
| [`get_field`](#fiftyone.core.labels.TemporalDetections.get_field)(field_name)                          | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.labels.TemporalDetections.get_text_score)()                          | Get text score from text query                                                                             |
| [`has_attribute`](#fiftyone.core.labels.TemporalDetections.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                         |
| [`has_field`](#fiftyone.core.labels.TemporalDetections.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                             |
| [`iter_attributes`](#fiftyone.core.labels.TemporalDetections.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                               |
| [`iter_fields`](#fiftyone.core.labels.TemporalDetections.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.labels.TemporalDetections.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                              |
| [`set_attribute_value`](#fiftyone.core.labels.TemporalDetections.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                       |
| [`set_field`](#fiftyone.core.labels.TemporalDetections.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.labels.TemporalDetections.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.labels.TemporalDetections.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.labels.TemporalDetections.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.labels.TemporalDetections.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.TemporalDetections.my_metaclass)   |    |
|---------------------------------------------------------------------------|----|

#### detections

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.GeoLocation(\*args, \*\*kwargs)

Bases: `_HasID`, [`Label`](#fiftyone.core.labels.Label)

Location data in GeoJSON format.

* **Parameters:**
  * **point** (*None*) – a `[longitude, latitude]` point
  * **line** (*None*) – 

    a line defined by coordinates as shown below:
    ```default
    [[lon1, lat1], [lon2, lat2], ...]
    ```
  * **polygon** (*None*) – 

    a polygon defined by coorindates as shown below:
    ```default
    [
        [[lon1, lat1], [lon2, lat2], ...],
        [[lon1, lat1], [lon2, lat2], ...],
        ...
    ]
    ```

    where the first outer list describes the boundary of the polygon
    and any remaining entries describe holes

**Attributes:**

| [`point`](#fiftyone.core.labels.GeoLocation.point)             | A GeoJSON field storing a longitude and latitude coordinate point.                                                           |
|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`line`](#fiftyone.core.labels.GeoLocation.line)               | A GeoJSON field storing a line of longitude and latitude coordinates.                                                        |
| [`polygon`](#fiftyone.core.labels.GeoLocation.polygon)         | A GeoJSON field storing a polygon of longitude and latitude coordinates.                                                     |
| [`STRICT`](#fiftyone.core.labels.GeoLocation.STRICT)           |                                                                                                                              |
| [`field_names`](#fiftyone.core.labels.GeoLocation.field_names) | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.GeoLocation.id)                   | An Object ID field.                                                                                                          |
| [`tags`](#fiftyone.core.labels.GeoLocation.tags)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`to_geo_json`](#fiftyone.core.labels.GeoLocation.to_geo_json)()                                | Returns a GeoJSON `geometry` dict for this instance.                                                     |
|-------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [`from_geo_json`](#fiftyone.core.labels.GeoLocation.from_geo_json)(d)                           | Creates a [`GeoLocation`](#fiftyone.core.labels.GeoLocation) from a GeoJSON dictionary.                  |
| [`clean`](#fiftyone.core.labels.GeoLocation.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run. |
| [`clear_field`](#fiftyone.core.labels.GeoLocation.clear_field)(field_name)                      | Clears the field from the document.                                                                      |
| [`copy`](#fiftyone.core.labels.GeoLocation.copy)()                                              | Returns a deep copy of the document.                                                                     |
| [`delete_attribute`](#fiftyone.core.labels.GeoLocation.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                               |
| [`fancy_repr`](#fiftyone.core.labels.GeoLocation.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                          |
| [`field_to_mongo`](#fiftyone.core.labels.GeoLocation.field_to_mongo)(field_name)                |                                                                                                          |
| [`field_to_python`](#fiftyone.core.labels.GeoLocation.field_to_python)(field_name, value)       |                                                                                                          |
| [`from_dict`](#fiftyone.core.labels.GeoLocation.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                          |
| [`from_json`](#fiftyone.core.labels.GeoLocation.from_json)(s)                                   | Loads the document from a JSON string.                                                                   |
| [`get_attribute_value`](#fiftyone.core.labels.GeoLocation.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                     |
| [`get_field`](#fiftyone.core.labels.GeoLocation.get_field)(field_name)                          | Gets the field of the document.                                                                          |
| [`get_text_score`](#fiftyone.core.labels.GeoLocation.get_text_score)()                          | Get text score from text query                                                                           |
| [`has_attribute`](#fiftyone.core.labels.GeoLocation.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                       |
| [`has_field`](#fiftyone.core.labels.GeoLocation.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                           |
| [`iter_attributes`](#fiftyone.core.labels.GeoLocation.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                             |
| [`iter_fields`](#fiftyone.core.labels.GeoLocation.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                 |
| [`merge`](#fiftyone.core.labels.GeoLocation.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                            |
| [`set_attribute_value`](#fiftyone.core.labels.GeoLocation.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                     |
| [`set_field`](#fiftyone.core.labels.GeoLocation.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                               |
| [`to_dict`](#fiftyone.core.labels.GeoLocation.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                      |
| [`to_json`](#fiftyone.core.labels.GeoLocation.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                |
| [`to_mongo`](#fiftyone.core.labels.GeoLocation.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                           |
| [`validate`](#fiftyone.core.labels.GeoLocation.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                           |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.GeoLocation.my_metaclass)   |    |
|--------------------------------------------------------------------|----|

#### point

A GeoJSON field storing a longitude and latitude coordinate point.

The data is stored as `[longitude, latitude]`.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### line

A GeoJSON field storing a line of longitude and latitude coordinates.

The data is stored as follows:

```default
[[lon1, lat1], [lon2, lat2], ...]
```

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### polygon

A GeoJSON field storing a polygon of longitude and latitude coordinates.

The data is stored as follows:

```default
[
    [[lon1, lat1], [lon2, lat2], ...],
    [[lon1, lat1], [lon2, lat2], ...],
    ...
]
```

where the first element describes the boundary of the polygon and any
remaining entries describe holes.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_geo_json()

Returns a GeoJSON `geometry` dict for this instance.

* **Returns:**
  a GeoJSON dict

#### *classmethod* from_geo_json(d)

Creates a [`GeoLocation`](#fiftyone.core.labels.GeoLocation) from a GeoJSON dictionary.

* **Parameters:**
  **d** – a GeoJSON dict
* **Returns:**
  a [`GeoLocation`](#fiftyone.core.labels.GeoLocation)

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.labels.GeoLocations(\*args, \*\*kwargs)

Bases: `_HasID`, [`Label`](#fiftyone.core.labels.Label)

A batch of location data in GeoJSON format.

The attributes of this class accept lists of data in the format of the
corresponding attributes of [`GeoLocation`](#fiftyone.core.labels.GeoLocation).

* **Parameters:**
  * **points** (*None*) – a list of points
  * **lines** (*None*) – a list of lines
  * **polygons** (*None*) – a list of polygons

**Attributes:**

| [`points`](#fiftyone.core.labels.GeoLocations.points)           | A GeoJSON field storing a list of points.                                                                                    |
|-----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`lines`](#fiftyone.core.labels.GeoLocations.lines)             | A GeoJSON field storing a list of lines.                                                                                     |
| [`polygons`](#fiftyone.core.labels.GeoLocations.polygons)       | A GeoJSON field storing a list of polygons.                                                                                  |
| [`STRICT`](#fiftyone.core.labels.GeoLocations.STRICT)           |                                                                                                                              |
| [`field_names`](#fiftyone.core.labels.GeoLocations.field_names) | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.labels.GeoLocations.id)                   | An Object ID field.                                                                                                          |
| [`tags`](#fiftyone.core.labels.GeoLocations.tags)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |

**Methods:**

| [`to_geo_json`](#fiftyone.core.labels.GeoLocations.to_geo_json)()                                | Returns a GeoJSON `geometry` dict for this instance.                                                     |
|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [`from_geo_json`](#fiftyone.core.labels.GeoLocations.from_geo_json)(d)                           | Creates a [`GeoLocation`](#fiftyone.core.labels.GeoLocation) from a GeoJSON dictionary.                  |
| [`clean`](#fiftyone.core.labels.GeoLocations.clean)()                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run. |
| [`clear_field`](#fiftyone.core.labels.GeoLocations.clear_field)(field_name)                      | Clears the field from the document.                                                                      |
| [`copy`](#fiftyone.core.labels.GeoLocations.copy)()                                              | Returns a deep copy of the document.                                                                     |
| [`delete_attribute`](#fiftyone.core.labels.GeoLocations.delete_attribute)(name)                  | Deletes the attribute with the given name.                                                               |
| [`fancy_repr`](#fiftyone.core.labels.GeoLocations.fancy_repr)([class_name, select_fields, ...])  | Generates a customizable string representation of the document.                                          |
| [`field_to_mongo`](#fiftyone.core.labels.GeoLocations.field_to_mongo)(field_name)                |                                                                                                          |
| [`field_to_python`](#fiftyone.core.labels.GeoLocations.field_to_python)(field_name, value)       |                                                                                                          |
| [`from_dict`](#fiftyone.core.labels.GeoLocations.from_dict)(d[, extended])                       | Loads the document from a BSON/JSON dictionary.                                                          |
| [`from_json`](#fiftyone.core.labels.GeoLocations.from_json)(s)                                   | Loads the document from a JSON string.                                                                   |
| [`get_attribute_value`](#fiftyone.core.labels.GeoLocations.get_attribute_value)(name[, default]) | Gets the value of the attribute with the given name.                                                     |
| [`get_field`](#fiftyone.core.labels.GeoLocations.get_field)(field_name)                          | Gets the field of the document.                                                                          |
| [`get_text_score`](#fiftyone.core.labels.GeoLocations.get_text_score)()                          | Get text score from text query                                                                           |
| [`has_attribute`](#fiftyone.core.labels.GeoLocations.has_attribute)(name)                        | Determines whether the label has an attribute with the given name.                                       |
| [`has_field`](#fiftyone.core.labels.GeoLocations.has_field)(field_name)                          | Determines whether the document has a field of the given name.                                           |
| [`iter_attributes`](#fiftyone.core.labels.GeoLocations.iter_attributes)()                        | Returns an iterator over the custom attributes of the label.                                             |
| [`iter_fields`](#fiftyone.core.labels.GeoLocations.iter_fields)()                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                 |
| [`merge`](#fiftyone.core.labels.GeoLocations.merge)(doc[, merge_lists, merge_dicts, overwrite])  | Merges the contents of the given document into this document.                                            |
| [`set_attribute_value`](#fiftyone.core.labels.GeoLocations.set_attribute_value)(name, value)     | Sets the value of the attribute with the given name.                                                     |
| [`set_field`](#fiftyone.core.labels.GeoLocations.set_field)(field_name, value[, create])         | Sets the value of a field of the document.                                                               |
| [`to_dict`](#fiftyone.core.labels.GeoLocations.to_dict)([extended])                              | Serializes this document to a BSON/JSON dictionary.                                                      |
| [`to_json`](#fiftyone.core.labels.GeoLocations.to_json)([pretty_print])                          | Serializes the document to a JSON string.                                                                |
| [`to_mongo`](#fiftyone.core.labels.GeoLocations.to_mongo)(\*args, \*\*kwargs)                    | Return as SON data ready for use with MongoDB.                                                           |
| [`validate`](#fiftyone.core.labels.GeoLocations.validate)([clean])                               | Ensure that all fields' values are valid and that required fields are present.                           |

**Classes:**

| [`my_metaclass`](#fiftyone.core.labels.GeoLocations.my_metaclass)   |    |
|---------------------------------------------------------------------|----|

#### points

A GeoJSON field storing a list of points.

The data is stored as follows:

```default
[[lon1, lat1], [lon2, lat2], ...]
```

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### lines

A GeoJSON field storing a list of lines.

The data is stored as follows:

```default
[
    [[lon1, lat1], [lon2, lat2], ...],
    [[lon1, lat1], [lon2, lat2], ...],
    ...
]
```

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### polygons

A GeoJSON field storing a list of polygons.

The data is stored as follows:

```default
[
    [
        [[lon1, lat1], [lon2, lat2], ...],
        [[lon1, lat1], [lon2, lat2], ...],
        ...
    ],
    [
        [[lon1, lat1], [lon2, lat2], ...],
        [[lon1, lat1], [lon2, lat2], ...],
        ...
    ],
    ...
]
```

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_geo_json()

Returns a GeoJSON `geometry` dict for this instance.

* **Returns:**
  a GeoJSON dict

#### *classmethod* from_geo_json(d)

Creates a [`GeoLocation`](#fiftyone.core.labels.GeoLocation) from a GeoJSON dictionary.

* **Parameters:**
  **d** – a GeoJSON dict
* **Returns:**
  a [`GeoLocation`](#fiftyone.core.labels.GeoLocation)

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a `SerializableDocument`

#### delete_attribute(name)

Deletes the attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Raises:**
  **AttributeError** – if the attribute does not exist

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a `SerializableDocument`

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a `SerializableDocument`

#### get_attribute_value(name, default=<fiftyone.core.labels._NoDefault object>)

Gets the value of the attribute with the given name.

* **Parameters:**
  * **name** – the attribute name
  * **default** (*no_default*) – a default value to return if the attribute
    does not exist. Can be `None`
* **Returns:**
  the attribute value
* **Raises:**
  **AttributeError** – if the attribute does not exist and no default
      value was provided

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_attribute(name)

Determines whether the label has an attribute with the given name.

* **Parameters:**
  **name** – the attribute name
* **Returns:**
  True/False

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### iter_attributes()

Returns an iterator over the custom attributes of the label.

* **Returns:**
  a generator that emits `(name, value)` tuples

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a `SerializableDocument` of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_attribute_value(name, value)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

* **Parameters:**
  * **name** – the attribute name
  * **value** – the value

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.
