class DatasetMixin(object): (source)
Known subclasses: fiftyone.core.odm.frame.DatasetFrameDocument
, fiftyone.core.odm.sample.DatasetSampleDocument
Mixin interface for fiftyone.core.odm.document.Document
subclasses that are backed by a dataset.
Class Method | add |
Adds a new field or embedded field to the document, if necessary. |
Class Method | add |
Adds the field or embedded field to the document, if necessary, inferring the field type from the provided value. |
Class Method | get |
Returns a schema dictionary describing the fields of this document. |
Class Method | merge |
Merges the field schema into this document. |
Method | __setattr__ |
Undocumented |
Method | clear |
Undocumented |
Method | get |
Undocumented |
Method | set |
Undocumented |
Instance Variable | created |
Undocumented |
Instance Variable | last |
Undocumented |
Property | collection |
Undocumented |
Property | field |
Undocumented |
Class Method | _add |
Undocumented |
Class Method | _clear |
Clears the field(s) of the documents in this collection. |
Class Method | _clear |
Undocumented |
Class Method | _clear |
Undocumented |
Class Method | _clone |
Undocumented |
Class Method | _clone |
Clones the field(s) of the documents in this collection. |
Class Method | _clone |
Undocumented |
Class Method | _clone |
Undocumented |
Class Method | _create |
Undocumented |
Class Method | _declare |
Undocumented |
Class Method | _delete |
Undocumented |
Class Method | _delete |
Deletes the field(s) from the documents in this collection. |
Class Method | _delete |
Undocumented |
Class Method | _delete |
Undocumented |
Class Method | _doc |
Undocumented |
Class Method | _fields |
Undocumented |
Class Method | _get |
Undocumented |
Class Method | _get |
Undocumented |
Class Method | _get |
Undocumented |
Class Method | _get |
Undocumented |
Class Method | _handle |
Undocumented |
Class Method | _handle |
Undocumented |
Class Method | _merge |
Undocumented |
Class Method | _parse |
Undocumented |
Class Method | _reload |
Undocumented |
Class Method | _remove |
Removes the dynamic embedded field(s) from the collection's schema. |
Class Method | _rename |
Undocumented |
Class Method | _rename |
Renames the fields of the documents in this collection. |
Class Method | _rename |
Undocumented |
Class Method | _rename |
Undocumented |
Class Method | _rename |
Undocumented |
Class Method | _to |
Undocumented |
Class Method | _undeclare |
Undocumented |
Class Method | _update |
Undocumented |
Class Method | _update |
Undocumented |
Method | _deferred |
Undocumented |
Method | _do |
Undocumented |
Method | _extract |
Extracts updates for filtered list fields that need to be updated by ID, not relative position (index). |
Method | _get |
Undocumented |
Method | _insert |
Undocumented |
Method | _parse |
Converts the list_element_field and filtered_field to an element object ID and array filter. |
Method | _update |
Undocumented |
Class Variable | _dataset |
Undocumented |
Class Variable | _is |
Undocumented |
def add_field(cls, path, ftype, embedded_doc_type=None, subfield=None, fields=None, description=None, info=None, read_only=False, expand_schema=True, recursive=True, validate=True, **kwargs): (source) ¶
Adds a new field or embedded field to the document, if necessary.
Parameters | |
path | the field name or embedded.field.name |
ftype | the field type to create. Must be a subclass of
fiftyone.core.fields.Field |
embeddedNone | the
fiftyone.core.odm.BaseEmbeddedDocument type of the
field. Only applicable when ftype is
fiftyone.core.fields.EmbeddedDocumentField |
subfield:None | the fiftyone.core.fields.Field type of
the contained field. Only applicable when ftype is
fiftyone.core.fields.ListField or
fiftyone.core.fields.DictField |
fields:None | a list of fiftyone.core.fields.Field
instances defining embedded document attributes. Only
applicable when ftype is
fiftyone.core.fields.EmbeddedDocumentField |
description:None | an optional description |
info:None | an optional info dict |
readFalse | whether the field should be read-only |
expandTrue | whether to add new fields to the schema (True) or simply validate that the field already exists with a consistent type (False) |
recursive:True | whether to recursively add embedded document fields |
validate:True | whether to validate the field against an existing field at the same path |
**kwargs | Undocumented |
Returns | |
True/False whether one or more fields or embedded fields were added to the document or its children | |
Raises | |
ValueError | if a field in the schema is not compliant with an existing field of the same name |
def add_implied_field(cls, path, value, expand_schema=True, dynamic=False, recursive=True, validate=True): (source) ¶
Adds the field or embedded field to the document, if necessary, inferring the field type from the provided value.
Parameters | |
path | the field name or embedded.field.name |
value | the field value |
expandTrue | whether to add new fields to the schema (True) or simply validate that the field already exists with a consistent type (False) |
dynamic:False | whether to declare dynamic embedded document fields |
recursive:True | whether to recursively add embedded document fields |
validate:True | whether to validate the field against an existing field at the same path |
Returns | |
True/False whether one or more fields or embedded fields were added to the document or its children | |
Raises | |
ValueError | if a field in the schema is not compliant with an existing field of the same name |
def get_field_schema(cls, ftype=None, embedded_doc_type=None, read_only=None, info_keys=None, created_after=None, include_private=False, flat=False, mode=None): (source) ¶
Returns a schema dictionary describing the fields of this document.
If the document belongs to a dataset, the schema will apply to all documents in the collection.
Parameters | |
ftype:None | an optional field type or iterable of field types to
which to restrict the returned schema. Must be subclass(es) of
fiftyone.core.fields.Field |
embeddedNone | an optional embedded document type or
iterable of types to which to restrict the returned schema.
Must be subclass(es) of
fiftyone.core.odm.BaseEmbeddedDocument |
readNone | whether to restrict to (True) or exclude (False) read-only fields. By default, all fields are included |
infoNone | an optional key or list of keys that must be in the field's info dict |
createdNone | an optional datetime specifying a minimum creation date |
includeFalse | whether to include fields that start with _ in the returned schema |
flat:False | whether to return a flattened schema where all embedded document fields are included as top-level keys |
mode:None | whether to apply the above constraints before and/or
after flattening the schema. Only applicable when ``flat` is
True. Supported values are ("before", "after", "both").
The default is "after" |
Returns | |
a dict mapping field names to fiftyone.core.fields.Field
instances |
def merge_field_schema(cls, schema, expand_schema=True, recursive=True, validate=True, overwrite=False): (source) ¶
Merges the field schema into this document.
Parameters | |
schema | a dict mapping field names or embedded.field.names to
fiftyone.core.fields.Field instances |
expandTrue | whether to add new fields to the schema (True) or simply validate that fields already exist with consistent types (False) |
recursive:True | whether to recursively merge embedded document fields |
validate:True | whether to validate fields against existing fields at the same path |
overwrite:False | whether to overwrite the editable metadata of existing fields |
Returns | |
True/False whether any new fields were added | |
Raises | |
ValueError | if a field in the schema is not compliant with an existing field of the same name or a new field is found but expand_schema == False |
Undocumented
fiftyone.core.odm.frame.DatasetFrameDocument
, fiftyone.core.odm.sample.DatasetSampleDocument
Undocumented
fiftyone.core.odm.frame.DatasetFrameDocument
, fiftyone.core.odm.sample.DatasetSampleDocument
Undocumented
Clears the field(s) of the documents in this collection.
Parameters | |
sample | the
fiftyone.core.samples.SampleCollection |
paths | an iterable of field names or embedded.field.names |
Clones the field(s) of the documents in this collection.
Parameters | |
sample | the
fiftyone.core.samples.SampleCollection |
paths | an iterable of field names or embedded.field.names |
new | an iterable of new field names or embedded.field.names |
def _create_field(cls, path, ftype, embedded_doc_type=None, subfield=None, fields=None, description=None, info=None, read_only=False, **kwargs): (source) ¶
Undocumented
Deletes the field(s) from the documents in this collection.
Parameters | |
paths | an iterable of field names or embedded.field.names |
error | the error level to use. Valid values are: |
- 0 | raise error if a field cannot be deleted |
- 1 | log warning if a field cannot be deleted |
- 2 | ignore fields that cannot be deleted |
def _merge_field(cls, path, field, validate=True, recursive=True, overwrite=False): (source) ¶
Undocumented
Removes the dynamic embedded field(s) from the collection's schema.
The actual data is not deleted from the collection.
Parameters | |
paths | an iterable of embedded.field.names |
error | the error level to use. Valid values are: |
- 0 | raise error if a field cannot be removed |
- 1 | log warning if a field cannot be removed |
- 2 | ignore fields that cannot be removed |
Renames the fields of the documents in this collection.
Parameters | |
sample | the
fiftyone.core.samples.SampleCollection |
paths | an iterable of field names or embedded.field.names |
new | an iterable of new field names or embedded.field.names |
Extracts updates for filtered list fields that need to be updated by ID, not relative position (index).
Converts the list_element_field and filtered_field to an element object ID and array filter.
Example:
Input: list_element_field = "test_dets.detections.1.label" filtered_field = "test_dets.detections" Output: ObjectId("5f2062bf27c024654f5286a0") "test_dets.detections.$[element].label"
Undocumented
fiftyone.core.odm.frame.DatasetFrameDocument
, fiftyone.core.odm.sample.DatasetSampleDocument
Undocumented