class ViewStage(object): (source)
Known subclasses: fiftyone.core.stages.Concat
, fiftyone.core.stages.Exclude
, fiftyone.core.stages.ExcludeBy
, fiftyone.core.stages.ExcludeFields
, fiftyone.core.stages.ExcludeFrames
, fiftyone.core.stages.ExcludeGroups
, fiftyone.core.stages.ExcludeLabels
, fiftyone.core.stages.Exists
, fiftyone.core.stages.FilterField
, fiftyone.core.stages.FilterKeypoints
, fiftyone.core.stages.FilterLabels
, fiftyone.core.stages.Flatten
, fiftyone.core.stages.GroupBy
, fiftyone.core.stages.Limit
, fiftyone.core.stages.LimitLabels
, fiftyone.core.stages.MapLabels
, fiftyone.core.stages.Match
, fiftyone.core.stages.MatchFrames
, fiftyone.core.stages.MatchLabels
, fiftyone.core.stages.MatchTags
, fiftyone.core.stages.Mongo
, fiftyone.core.stages.Select
, fiftyone.core.stages.SelectBy
, fiftyone.core.stages.SelectFields
, fiftyone.core.stages.SelectFrames
, fiftyone.core.stages.SelectGroups
, fiftyone.core.stages.SelectGroupSlices
, fiftyone.core.stages.SelectLabels
, fiftyone.core.stages.SetField
, fiftyone.core.stages.Shuffle
, fiftyone.core.stages.Skip
, fiftyone.core.stages.SortBy
, fiftyone.core.stages.SortBySimilarity
, fiftyone.core.stages.Take
, fiftyone.core.stages.ToClips
, fiftyone.core.stages.ToEvaluationPatches
, fiftyone.core.stages.ToFrames
, fiftyone.core.stages.ToPatches
, fiftyone.core.stages.ToTrajectories
, fiftyone.core.stages._GeoStage
Abstract base class for all view stages.
ViewStage
instances represent logical operations to apply to
fiftyone.core.collections.SampleCollection
instances, which may
decide what subset of samples in the collection should pass though the
stage, and also what subset of the contents of each
fiftyone.core.sample.Sample
should be passed. The output of
view stages are represented by a fiftyone.core.view.DatasetView
.
Method | __eq__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | get |
Returns a list of names of fields or embedded fields that may have been edited by the stage, if any. |
Method | get |
Returns a list of fields that have been excluded by the stage, if any. |
Method | get |
Returns a list of names of fields or embedded fields that contain arrays have been filtered by the stage, if any. |
Method | get |
Returns the dynamic group expression for the given stage, if any. |
Method | get |
Returns the media type outputted by this stage when applied to the given collection, if and only if it is different from the input type. |
Method | get |
Returns a list of fields that have been selected by the stage, if any. |
Method | load |
Loads the fiftyone.core.view.DatasetView containing the output of the stage. |
Method | to |
Returns the MongoDB aggregation pipeline for the stage. |
Method | validate |
Validates that the stage can be applied to the given collection. |
Property | has |
Whether this stage's output view should be loaded via load_view rather than appending stages to an aggregation pipeline via to_mongo . |
Property | outputs |
Whether this stage outputs or flattens dynamic groups. |
Class Method | _from |
Creates a ViewStage instance from a serialized JSON dict representation of it. |
Class Method | _params |
Returns a list of JSON dicts describing the stage's supported parameters. |
Method | _kwargs |
Returns a list of [name, value] lists describing the parameters of this stage instance. |
Method | _needs |
Whether the stage requires frame labels of video samples to be attached. |
Method | _needs |
Whether the stage requires group slice(s) to be attached. |
Method | _serialize |
Returns a JSON dict representation of the ViewStage . |
Instance Variable | _uuid |
Undocumented |
fiftyone.core.stages.ExcludeLabels
, fiftyone.core.stages.FilterField
, fiftyone.core.stages.FilterKeypoints
, fiftyone.core.stages.FilterLabels
, fiftyone.core.stages.LimitLabels
, fiftyone.core.stages.MapLabels
, fiftyone.core.stages.SelectLabels
, fiftyone.core.stages.SetField
Returns a list of names of fields or embedded fields that may have been edited by the stage, if any.
The "frames." prefix should be omitted when frames is True.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
frames:False | whether to return sample-level (False) or frame-level (True) fields |
Returns | |
a list of fields, or None if no fields have been edited |
fiftyone.core.stages.ExcludeFields
Returns a list of fields that have been excluded by the stage, if any.
View stages only need to report excluded fields if they insist that excluded fields not appear in the schema of the returned view.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
frames:False | whether to return sample-level (False) or frame-level (True) fields |
Returns | |
a list of fields, or None if no fields have been selected |
fiftyone.core.stages.ExcludeLabels
, fiftyone.core.stages.FilterLabels
, fiftyone.core.stages.LimitLabels
, fiftyone.core.stages.SelectLabels
Returns a list of names of fields or embedded fields that contain arrays have been filtered by the stage, if any.
For example, if a stage filters a
fiftyone.core.labels.Detections
field called
"predictions", it should include "predictions.detections" in
the returned list.
The "frames." prefix should be omitted when frames is True.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
frames:False | whether to return sample-level (False) or frame-level (True) fields |
Returns | |
a list of fields, or None if no fields have been filtered |
fiftyone.core.stages.GroupBy
Returns the dynamic group expression for the given stage, if any.
Only usable if outputs_dynamic_groups
is True.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
Returns | |
a tuple of
|
fiftyone.core.stages.Flatten
, fiftyone.core.stages.GroupBy
, fiftyone.core.stages.SelectGroupSlices
Returns the media type outputted by this stage when applied to the given collection, if and only if it is different from the input type.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
Returns | |
the media type, or None if the stage does not change the type |
fiftyone.core.stages.SelectFields
Returns a list of fields that have been selected by the stage, if any.
View stages only need to report selected fields if they insist that non-selected fields not appear in the schema of the returned view.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
frames:False | whether to return sample-level (False) or frame-level (True) fields |
Returns | |
a list of fields, or None if no fields have been selected |
fiftyone.core.stages.ToClips
, fiftyone.core.stages.ToEvaluationPatches
, fiftyone.core.stages.ToFrames
, fiftyone.core.stages.ToPatches
, fiftyone.core.stages.ToTrajectories
Loads the fiftyone.core.view.DatasetView
containing the
output of the stage.
Only usable if has_view
is True.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
Returns | |
a fiftyone.core.view.DatasetView |
fiftyone.core.stages.Concat
, fiftyone.core.stages.Exclude
, fiftyone.core.stages.ExcludeBy
, fiftyone.core.stages.ExcludeFields
, fiftyone.core.stages.ExcludeFrames
, fiftyone.core.stages.ExcludeGroups
, fiftyone.core.stages.ExcludeLabels
, fiftyone.core.stages.Exists
, fiftyone.core.stages.FilterField
, fiftyone.core.stages.FilterKeypoints
, fiftyone.core.stages.FilterLabels
, fiftyone.core.stages.Flatten
, fiftyone.core.stages.GeoNear
, fiftyone.core.stages.GeoWithin
, fiftyone.core.stages.GroupBy
, fiftyone.core.stages.Limit
, fiftyone.core.stages.LimitLabels
, fiftyone.core.stages.MapLabels
, fiftyone.core.stages.Match
, fiftyone.core.stages.MatchFrames
, fiftyone.core.stages.MatchLabels
, fiftyone.core.stages.MatchTags
, fiftyone.core.stages.Mongo
, fiftyone.core.stages.Select
, fiftyone.core.stages.SelectBy
, fiftyone.core.stages.SelectFields
, fiftyone.core.stages.SelectFrames
, fiftyone.core.stages.SelectGroups
, fiftyone.core.stages.SelectGroupSlices
, fiftyone.core.stages.SelectLabels
, fiftyone.core.stages.SetField
, fiftyone.core.stages.Shuffle
, fiftyone.core.stages.Skip
, fiftyone.core.stages.SortBy
, fiftyone.core.stages.SortBySimilarity
, fiftyone.core.stages.Take
Returns the MongoDB aggregation pipeline for the stage.
Only usable if has_view
is False.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
Returns | |
a MongoDB aggregation pipeline (list of dicts) |
fiftyone.core.stages.Concat
, fiftyone.core.stages.ExcludeFields
, fiftyone.core.stages.ExcludeFrames
, fiftyone.core.stages.ExcludeGroups
, fiftyone.core.stages.ExcludeLabels
, fiftyone.core.stages.FilterField
, fiftyone.core.stages.FilterLabels
, fiftyone.core.stages.Flatten
, fiftyone.core.stages.GroupBy
, fiftyone.core.stages.LimitLabels
, fiftyone.core.stages.MapLabels
, fiftyone.core.stages.MatchFrames
, fiftyone.core.stages.MatchLabels
, fiftyone.core.stages.Select
, fiftyone.core.stages.SelectFields
, fiftyone.core.stages.SelectFrames
, fiftyone.core.stages.SelectGroups
, fiftyone.core.stages.SelectGroupSlices
, fiftyone.core.stages.SelectLabels
, fiftyone.core.stages.SetField
, fiftyone.core.stages.SortBy
, fiftyone.core.stages.SortBySimilarity
, fiftyone.core.stages._GeoStage
Validates that the stage can be applied to the given collection.
Parameters | |
sample | a
fiftyone.core.collections.SampleCollection |
Raises | |
ViewStageError | if the stage cannot be applied to the collection |
fiftyone.core.stages.Flatten
, fiftyone.core.stages.GroupBy
Whether this stage outputs or flattens dynamic groups.
The possible return values are:
- True: this stage dynamically groups the input collection
- False: this stage flattens dynamic groups
- None: this stage does not change group status
fiftyone.core.stages.Concat
, fiftyone.core.stages.Exclude
, fiftyone.core.stages.ExcludeBy
, fiftyone.core.stages.ExcludeFields
, fiftyone.core.stages.ExcludeFrames
, fiftyone.core.stages.ExcludeGroups
, fiftyone.core.stages.ExcludeLabels
, fiftyone.core.stages.Exists
, fiftyone.core.stages.FilterField
, fiftyone.core.stages.FilterKeypoints
, fiftyone.core.stages.FilterLabels
, fiftyone.core.stages.Flatten
, fiftyone.core.stages.GeoNear
, fiftyone.core.stages.GeoWithin
, fiftyone.core.stages.GroupBy
, fiftyone.core.stages.Limit
, fiftyone.core.stages.LimitLabels
, fiftyone.core.stages.MapLabels
, fiftyone.core.stages.Match
, fiftyone.core.stages.MatchFrames
, fiftyone.core.stages.MatchLabels
, fiftyone.core.stages.MatchTags
, fiftyone.core.stages.Mongo
, fiftyone.core.stages.Select
, fiftyone.core.stages.SelectBy
, fiftyone.core.stages.SelectFields
, fiftyone.core.stages.SelectFrames
, fiftyone.core.stages.SelectGroups
, fiftyone.core.stages.SelectGroupSlices
, fiftyone.core.stages.SelectLabels
, fiftyone.core.stages.SetField
, fiftyone.core.stages.Shuffle
, fiftyone.core.stages.Skip
, fiftyone.core.stages.SortBy
, fiftyone.core.stages.SortBySimilarity
, fiftyone.core.stages.Take
, fiftyone.core.stages.ToClips
, fiftyone.core.stages.ToEvaluationPatches
, fiftyone.core.stages.ToFrames
, fiftyone.core.stages.ToPatches
, fiftyone.core.stages.ToTrajectories
Returns a list of JSON dicts describing the stage's supported parameters.
Returns | |
a list of JSON dicts |
fiftyone.core.stages.Concat
, fiftyone.core.stages.Exclude
, fiftyone.core.stages.ExcludeBy
, fiftyone.core.stages.ExcludeFields
, fiftyone.core.stages.ExcludeFrames
, fiftyone.core.stages.ExcludeGroups
, fiftyone.core.stages.ExcludeLabels
, fiftyone.core.stages.Exists
, fiftyone.core.stages.FilterField
, fiftyone.core.stages.FilterKeypoints
, fiftyone.core.stages.FilterLabels
, fiftyone.core.stages.Flatten
, fiftyone.core.stages.GeoNear
, fiftyone.core.stages.GeoWithin
, fiftyone.core.stages.GroupBy
, fiftyone.core.stages.Limit
, fiftyone.core.stages.LimitLabels
, fiftyone.core.stages.MapLabels
, fiftyone.core.stages.Match
, fiftyone.core.stages.MatchFrames
, fiftyone.core.stages.MatchLabels
, fiftyone.core.stages.MatchTags
, fiftyone.core.stages.Mongo
, fiftyone.core.stages.Select
, fiftyone.core.stages.SelectBy
, fiftyone.core.stages.SelectFields
, fiftyone.core.stages.SelectFrames
, fiftyone.core.stages.SelectGroups
, fiftyone.core.stages.SelectGroupSlices
, fiftyone.core.stages.SelectLabels
, fiftyone.core.stages.SetField
, fiftyone.core.stages.Shuffle
, fiftyone.core.stages.Skip
, fiftyone.core.stages.SortBy
, fiftyone.core.stages.SortBySimilarity
, fiftyone.core.stages.Take
, fiftyone.core.stages.ToClips
, fiftyone.core.stages.ToEvaluationPatches
, fiftyone.core.stages.ToFrames
, fiftyone.core.stages.ToPatches
, fiftyone.core.stages.ToTrajectories
Returns a list of [name, value] lists describing the parameters of this stage instance.
Returns | |
a list of [name, value] lists |
fiftyone.core.stages.ExcludeFields
, fiftyone.core.stages.ExcludeFrames
, fiftyone.core.stages.ExcludeLabels
, fiftyone.core.stages.Exists
, fiftyone.core.stages.FilterField
, fiftyone.core.stages.FilterKeypoints
, fiftyone.core.stages.FilterLabels
, fiftyone.core.stages.GroupBy
, fiftyone.core.stages.LimitLabels
, fiftyone.core.stages.MapLabels
, fiftyone.core.stages.Match
, fiftyone.core.stages.MatchFrames
, fiftyone.core.stages.MatchLabels
, fiftyone.core.stages.Mongo
, fiftyone.core.stages.SelectFields
, fiftyone.core.stages.SelectFrames
, fiftyone.core.stages.SelectLabels
, fiftyone.core.stages.SetField
, fiftyone.core.stages.SortBy
Whether the stage requires frame labels of video samples to be attached.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
Returns | |
True/False |
fiftyone.core.stages.ExcludeFields
, fiftyone.core.stages.ExcludeLabels
, fiftyone.core.stages.Exists
, fiftyone.core.stages.FilterField
, fiftyone.core.stages.FilterKeypoints
, fiftyone.core.stages.FilterLabels
, fiftyone.core.stages.GroupBy
, fiftyone.core.stages.LimitLabels
, fiftyone.core.stages.MapLabels
, fiftyone.core.stages.Match
, fiftyone.core.stages.MatchLabels
, fiftyone.core.stages.Mongo
, fiftyone.core.stages.SelectFields
, fiftyone.core.stages.SelectLabels
, fiftyone.core.stages.SetField
, fiftyone.core.stages.SortBy
Whether the stage requires group slice(s) to be attached.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the stage is being applied |
Returns | |
None, or a list of group slices |