class SampleView(_SampleMixin, DocumentView): (source)
Known subclasses: fiftyone.core.clips.ClipView
, fiftyone.core.video.FrameView
, fiftyone.core.patches._PatchView
Constructor: SampleView(doc, view, selected_fields, excluded_fields, filtered_fields)
A view into a Sample
in a dataset.
Like Sample
instances, the fields of a SampleView
instance can be modified, new fields can be created, and any changes can be
saved to the database.
SampleView
instances differ from Sample
instances in the
following ways:
- A sample view may contain only a subset of the fields of its source sample, either by selecting and/or excluding specific fields
- A sample view may contain array fields or embedded array fields that have been filtered, thus containing only a subset of the array elements from the source sample
- Excluded fields of a sample view may not be accessed or modified
Note
Sample views should never be created manually; they are generated when
accessing the samples in a fiftyone.core.view.DatasetView
.
Parameters | |
doc | a fiftyone.core.odm.mixins.DatasetSampleDocument |
view | the fiftyone.core.view.DatasetView that the sample
belongs to |
selected | a set of field names that this sample view is restricted to, if any |
excluded | a set of field names that are excluded from this sample view, if any |
filtered | a set of field names of list fields that are filtered in this sample view, if any |
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | save |
Saves the sample view to the database. |
Method | to |
Serializes the sample view to a JSON dictionary. |
Method | _save |
Undocumented |
Instance Variable | _frames |
Undocumented |
Inherited from _SampleMixin
:
Method | __getattr__ |
Undocumented |
Method | __getitem__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __setattr__ |
Undocumented |
Method | __setitem__ |
Undocumented |
Method | add |
Adds the given labels to the sample. |
Method | clear |
Undocumented |
Method | compute |
Populates the metadata field of the sample. |
Method | copy |
Returns a deep copy of the sample that has not been added to the database. |
Method | get |
Undocumented |
Method | merge |
Merges the fields of the given sample into this sample. |
Method | set |
Undocumented |
Property | dataset |
Undocumented |
Property | filename |
The basename of the media's filepath. |
Property | media |
The media type of the sample. |
Method | _parse |
Undocumented |
Method | _secure |
Undocumented |
Property | _dataset |
Undocumented |
Inherited from DocumentView
(via _SampleMixin
):
Method | has |
Determines whether the document has the given field. |
Method | to |
Serializes the document to a BSON dictionary equivalent to the representation that would be stored in the database. |
Property | excluded |
The set of field names that are excluded on this document view, or None if no fields are explicitly excluded. |
Property | field |
An ordered tuple of field names of this document view. |
Property | filtered |
The set of field names or embedded.field.names that have been filtered on this document view, or None if no fields are filtered. |
Property | selected |
The set of field names that are selected on this document view, or None if no fields are explicitly selected. |
Method | _get |
Returns an ordered tuple of field names of this document. |
Method | _reload |
Undocumented |
Method | _to |
Undocumented |
Instance Variable | _excluded |
Undocumented |
Instance Variable | _filtered |
Undocumented |
Instance Variable | _selected |
Undocumented |
Instance Variable | _view |
Undocumented |
Property | _collection |
The fiftyone.core.collections.SampleCollection from which this document was taken, or None if it is not in a dataset. |
Inherited from _Document
(via _SampleMixin
, DocumentView
):
Method | __contains__ |
Undocumented |
Method | __copy__ |
Undocumented |
Method | __delattr__ |
Undocumented |
Method | __delitem__ |
Undocumented |
Method | __dir__ |
Undocumented |
Method | __eq__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | iter |
Returns an iterator over the (name, value) pairs of the public fields of the document. |
Method | to |
Serializes the document to a JSON string. |
Method | update |
Sets the dictionary of fields on the document. |
Property | dataset |
The dataset to which this document belongs, or None if it has not been added to a dataset. |
Property | in |
Whether the document has been added to a dataset. |
Method | _iter |
Undocumented |
Method | _parse |
Undocumented |
Instance Variable | _dataset |
Undocumented |
Instance Variable | _doc |
Undocumented |
Property | _id |
The ObjectId of the document, or None if it has not been added to the database. |
Property | _in |
Whether the document has been inserted into the database. |
Undocumented
fiftyone.core.document.DocumentView.save
Saves the sample view to the database.
Warning
This will permanently delete any omitted or filtered contents from the source dataset.
fiftyone.core.clips.ClipView
, fiftyone.core.video.FrameView
, fiftyone.core.patches._PatchView
Undocumented