class Frames(object): (source)
Known subclasses: fiftyone.core.frame.FramesView
Constructor: Frames(sample)
An ordered dictionary of Frame
instances keyed by frame number
representing the frames of a video fiftyone.core.sample.Sample
.
Frames
instances behave like defaultdict(Frame) instances; an
empty Frame
instance is returned when accessing a new frame
number.
Frames
instances should never be created manually; they are
instantiated automatically when video fiftyone.core.sample.Sample
instances are created.
Parameters | |
sample | the fiftyone.core.sample.Sample to which the frames
are attached |
Method | __bool__ |
Undocumented |
Method | __contains__ |
Undocumented |
Method | __delitem__ |
Undocumented |
Method | __getitem__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __len__ |
Undocumented |
Method | __next__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __setitem__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | add |
Adds the frame to this instance. |
Method | clear |
Removes all frames from this sample. |
Method | delete |
Deletes the given frame number from this instance. |
Method | first |
Returns the first Frame for the sample. |
Method | head |
Returns a list of the first few frames for the sample. |
Method | items |
Returns an iterator over the frame numberes and Frame instances for the sample. |
Method | keys |
Returns an iterator over the frame numbers with labels in the sample. |
Method | last |
Returns the last Frame for the sample. |
Method | merge |
Merges the given frames into this instance. |
Method | reload |
Reloads all frames for the sample from the database. |
Method | save |
Saves all frames for the sample to the database. |
Method | tail |
Returns a list of the last few frames for the sample. |
Method | update |
Adds the frame labels to this instance. |
Method | values |
Returns an iterator over the Frame instances for the sample. |
Property | field |
An ordered tuple of the names of the fields on the frames. |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _iter |
Undocumented |
Method | _iter |
Undocumented |
Method | _make |
Undocumented |
Method | _make |
Undocumented |
Method | _save |
Undocumented |
Method | _save |
Undocumented |
Method | _save |
Undocumented |
Method | _set |
Undocumented |
Method | _to |
Undocumented |
Method | _validate |
Undocumented |
Instance Variable | _delete |
Undocumented |
Instance Variable | _delete |
Undocumented |
Instance Variable | _iter |
Undocumented |
Instance Variable | _replacements |
Undocumented |
Instance Variable | _sample |
Undocumented |
Property | _dataset |
Undocumented |
Property | _frame |
Undocumented |
Property | _frame |
Undocumented |
Property | _in |
Undocumented |
Property | _sample |
Undocumented |
Property | _sample |
Undocumented |
fiftyone.core.frame.FramesView
Adds the frame to this instance.
If an existing frame with the same frame number exists, it is overwritten.
If the provided frame is a Frame
instance that does not belong
to a dataset, it is updated in-place to reflect its membership in this
dataset. Otherwise, the provided frame is not modified.
Parameters | |
frame | the frame number |
frame | a Frame or FrameView |
expandTrue | whether to dynamically add new frame fields encountered to the dataset schema. If False, an error is raised if the frame's schema is not a subset of the dataset schema |
validate:True | whether to validate values for existing fields |
dynamic:False | whether to declare dynamic embedded document fields |
Returns a list of the first few frames for the sample.
If fewer than num_frames frames exist, only the available frames are returned.
Parameters | |
num | the number of frames |
Returns | |
a list of Frame objects |
Returns an iterator over the frame numberes and Frame
instances for the sample.
The frames are traversed in ascending order.
Returns | |
a generator that emits (frame_number, Frame) tuples |
Returns an iterator over the frame numbers with labels in the sample.
The frames are traversed in ascending order.
Returns | |
a generator that emits frame numbers |
Merges the given frames into this instance.
The behavior of this method is highly customizable. By default, all
top-level fields from the provided frames are merged into existing
frames with the same frame numbers (and new frames created as
necessary), overwriting any existing values for those fields, with the
exception of list fields (e.g., tags) and label list fields (e.g.,
fiftyone.core.labels.Detections
fields), in which case the
elements of the lists themselves are merged. In the case of label list
fields, labels with the same id in both frames are updated rather
than duplicated.
To avoid confusion between missing fields and fields whose value is None, None-valued fields are always treated as missing while merging.
This method can be configured in numerous ways, including:
- Whether new fields can be added to the frame schema
- Whether list fields should be treated as ordinary fields and merged as a whole rather than merging their elements
- Whether to merge only specific fields, or all but certain fields
- Mapping input frame fields to different field names of this frame
Parameters | |
frames | can be any of the following
|
fields:None | an optional field or iterable of fields to which to restrict the merge. This can also be a dict mapping field names of the input frame to field names of this frame |
omitNone | an optional field or iterable of fields to exclude from the merge |
mergeTrue | whether to merge the elements of list fields
(e.g., tags) and label list fields (e.g.,
fiftyone.core.labels.Detections fields) rather than
merging the entire top-level field like other field types.
For label lists fields, existing
fiftyone.core.label.Label elements are either replaced
(when overwrite is True) or kept (when overwrite is
False) when their id matches a label from the provided
frames |
overwrite:True | whether to overwrite (True) or skip (False) existing fields and label elements |
expandTrue | whether to dynamically add new frame fields encountered to the dataset schema. If False, an error is raised if the frame's schema is not a subset of the dataset schema |
validate:True | whether to validate values for existing fields |
dynamic:False | whether to declare dynamic embedded document fields |
fiftyone.core.frame.FramesView
Reloads all frames for the sample from the database.
Parameters | |
hard:False | whether to reload the frame schema in addition to the field values for the frames. This is necessary if new fields may have been added to the dataset's frame schema |
Returns a list of the last few frames for the sample.
If fewer than num_frames frames exist, only the available frames are returned.
Parameters | |
num | the number of frames |
Returns | |
a list of Frame objects |
Adds the frame labels to this instance.
Parameters | |
frames | can be any of the following
|
overwrite:True | whether to overwrite existing frames |
expandTrue | whether to dynamically add new frame fields encountered to the dataset schema. If False, an error is raised if the frame's schema is not a subset of the dataset schema |
validate:True | whether to validate values for existing fields |
dynamic:False | whether to declare dynamic embedded document fields |
fiftyone.core.frame.FramesView
An ordered tuple of the names of the fields on the frames.