class DatasetView(foc.SampleCollection): (source)
Known subclasses: fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Constructor: DatasetView(dataset, _stages, _media_type, _group_slice, _name)
A view into a fiftyone.core.dataset.Dataset
.
Dataset views represent ordered collections of subsets of samples in a dataset.
Operations on dataset views are designed to be chained together to yield
the desired subset of the dataset, which is then iterated over to directly
access the sample views. Each stage in the pipeline defining a dataset view
is represented by a fiftyone.core.stages.ViewStage
instance.
The stages of a dataset view specify:
- The subset of samples (and their order) that should be included
- The possibly-filtered fields of each sample that should be included
Samples retrieved from dataset views are returned as
fiftyone.core.sample.SampleView
objects, as opposed to
fiftyone.core.sample.Sample
objects, since they may contain a
subset of the sample's content.
See :ref:`this page <using-views>` for an overview of working with dataset views.
Parameters | |
dataset | the underlying fiftyone.core.dataset.Dataset for the
view |
Method | __copy__ |
Undocumented |
Method | __eq__ |
Undocumented |
Method | __getitem__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __len__ |
Undocumented |
Method | app |
Undocumented |
Method | classes |
Undocumented |
Method | clear |
Deletes all samples in the view from the underlying dataset. |
Method | clear |
Clears the values of the frame-level field from all samples in the view. |
Method | clear |
Clears the values of the frame-level fields from all samples in the view. |
Method | clear |
Deletes all frame labels from the samples in the view from the underlying dataset. |
Method | clear |
Clears the values of the field from all samples in the view. |
Method | clear |
Clears the values of the fields from all samples in the view. |
Method | clone |
Creates a new dataset containing a copy of the contents of the view. |
Method | clone |
Clones the frame-level field of the view into a new field. |
Method | clone |
Clones the frame-level fields of the view into new frame-level fields of the dataset. |
Method | clone |
Clones the given sample field of the view into a new field of the dataset. |
Method | clone |
Clones the given sample fields of the view into new fields of the dataset. |
Method | default |
Undocumented |
Method | default |
Undocumented |
Method | default |
Undocumented |
Method | description |
Undocumented |
Method | ensure |
Ensures that the video view contains frame instances for every frame of each sample's source video. |
Method | get |
Returns a view containing the samples from a dynamic grouped view with the given group value. |
Method | get |
Returns a schema dictionary describing the fields of the samples in the view. |
Method | get |
Returns a schema dictionary describing the fields of the frames of the samples in the view. |
Method | get |
Returns a dict containing the samples for the given group ID. |
Method | group |
Undocumented |
Method | info |
Undocumented |
Method | iter |
Returns an iterator over the dynamic groups in the view. |
Method | iter |
Returns an iterator over the groups in the view. |
Method | iter |
Returns an iterator over the samples in the view. |
Method | keep |
Deletes all samples that are not in the view from the underlying dataset. |
Method | keep |
Deletes all fields that are excluded from the view from the underlying dataset. |
Method | keep |
For each sample in the view, deletes all frames labels that are not in the view from the underlying dataset. |
Method | mask |
Undocumented |
Method | reload |
Reloads the view. |
Method | save |
Saves the contents of the view to the database. |
Method | skeletons |
Undocumented |
Method | summary |
Returns a string summary of the view. |
Method | tags |
Undocumented |
Method | to |
Returns a JSON dictionary representation of the view. |
Method | view |
Returns a copy of this view. |
Class Variable | __slots__ |
Undocumented |
Property | app |
Dataset-specific settings that customize how this collection is visualized in the :ref:`FiftyOne App <fiftyone-app>`. |
Property | classes |
The classes of the underlying dataset. |
Property | dataset |
The name of the underlying dataset. |
Property | default |
The default classes of the underlying dataset. |
Property | default |
The default group slice of the view, or None if the view is not grouped. |
Property | default |
The default mask targets of the underlying dataset. |
Property | default |
The default keypoint skeleton of the underlying dataset. |
Property | description |
A description of the underlying dataset. |
Property | group |
The group field of the view, or None if the view is not grouped. |
Property | group |
A dict mapping group slices to media types, or None if the view is not grouped. |
Property | group |
The current group slice of the view, or None if the view is not grouped. |
Property | group |
The list of group slices of the view, or None if the view is not grouped. |
Property | info |
The info dict of the underlying dataset. |
Property | is |
Whether the view is a saved view or not. |
Property | mask |
The mask targets of the underlying dataset. |
Property | media |
The media type of the view. |
Property | name |
The name of the view if it is a saved view; otherwise None. |
Property | skeletons |
The keypoint skeletons of the underlying dataset. |
Property | tags |
The list of tags of the underlying dataset. |
Static Method | _build |
Undocumented |
Method | _add |
Returns a fiftyone.core.view.DatasetView containing the contents of the collection with the given fiftyone.core.stages.ViewStage` appended to its aggregation pipeline. |
Method | _aggregate |
Runs the MongoDB aggregation pipeline on the collection and returns the result. |
Method | _dynamic |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _init |
Undocumented |
Method | _init |
Undocumented |
Method | _iter |
Undocumented |
Method | _iter |
Undocumented |
Method | _iter |
Undocumented |
Method | _make |
Undocumented |
Method | _make |
Undocumented |
Method | _make |
Undocumented |
Method | _needs |
Undocumented |
Method | _outputs |
Undocumented |
Method | _parse |
Undocumented |
Method | _pipeline |
Returns the MongoDB aggregation pipeline for the collection. |
Method | _serialize |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Method | _slice |
Undocumented |
Instance Variable | __dataset |
Undocumented |
Instance Variable | __group |
Undocumented |
Instance Variable | __media |
Undocumented |
Instance Variable | __name |
Undocumented |
Instance Variable | __stages |
Undocumented |
Instance Variable | _make |
Undocumented |
Instance Variable | _make |
Undocumented |
Property | _all |
Undocumented |
Property | _base |
Undocumented |
Property | _dataset |
The fiftyone.core.dataset.Dataset that serves the samples in this collection. |
Property | _frame |
Undocumented |
Property | _has |
Undocumented |
Property | _is |
Whether this collection contains clips. |
Property | _is |
Whether this collection contains dynamic groups. |
Property | _is |
Whether this collection contains frames of a video dataset. |
Property | _is |
Whether this collection's contents is generated from another collection. |
Property | _is |
Whether this collection contains patches. |
Property | _parent |
Undocumented |
Property | _root |
The root fiftyone.core.dataset.Dataset from which this collection is derived. |
Property | _sample |
Undocumented |
Property | _stages |
Undocumented |
Inherited from SampleCollection
:
Class Method | list |
Returns a list of all available methods on this collection that apply fiftyone.core.aggregations.Aggregation operations to this collection. |
Class Method | list |
Returns a list of all available methods on this collection that apply fiftyone.core.stages.ViewStage operations to this collection. |
Method | __add__ |
Undocumented |
Method | __bool__ |
Undocumented |
Method | __contains__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | add |
Applies the given fiftyone.core.stages.ViewStage to the collection. |
Method | aggregate |
Aggregates one or more fiftyone.core.aggregations.Aggregation instances. |
Method | annotate |
Exports the samples and optional label field(s) in this collection to the given annotation backend. |
Method | apply |
Applies the model to the samples in the collection. |
Method | bounds |
Computes the bounds of a numeric field of the collection. |
Method | compute |
Computes embeddings for the samples in the collection using the given model. |
Method | compute |
Populates the metadata field of all samples in the collection. |
Method | compute |
Computes embeddings for the image patches defined by patches_field of the samples in the collection using the given model. |
Method | concat |
Concatenates the contents of the given SampleCollection to this collection. |
Method | count |
Counts the number of field values in the collection. |
Method | count |
Counts the occurrences of all label tags in the specified label field(s) of this collection. |
Method | count |
Counts the occurrences of sample tags in this collection. |
Method | count |
Counts the occurrences of field values in the collection. |
Method | create |
Creates an index on the given field or with the given specification, if necessary. |
Method | delete |
Deletes the annotation run with the given key from this collection. |
Method | delete |
Deletes all annotation runs from this collection. |
Method | delete |
Deletes the brain method run with the given key from this collection. |
Method | delete |
Deletes all brain method runs from this collection. |
Method | delete |
Deletes the evaluation results associated with the given evaluation key from this collection. |
Method | delete |
Deletes all evaluation results from this collection. |
Method | delete |
Deletes the run with the given key from this collection. |
Method | delete |
Deletes all runs from this collection. |
Method | distinct |
Computes the distinct values of a field in the collection. |
Method | draw |
Renders annotated versions of the media in the collection with the specified label data overlaid to the given directory. |
Method | drop |
Drops the index for the given field or name, if necessary. |
Method | evaluate |
Evaluates the classification predictions in this collection with respect to the specified ground truth labels. |
Method | evaluate |
Evaluates the specified predicted detections in this collection with respect to the specified ground truth detections. |
Method | evaluate |
Evaluates the regression predictions in this collection with respect to the specified ground truth values. |
Method | evaluate |
Evaluates the specified semantic segmentation masks in this collection with respect to the specified ground truth masks. |
Method | exclude |
Excludes the samples with the given IDs from the collection. |
Method | exclude |
Excludes the samples with the given field values from the collection. |
Method | exclude |
Excludes the fields with the given names from the samples in the collection. |
Method | exclude |
Excludes the frames with the given IDs from the video collection. |
Method | exclude |
Excludes the groups with the given IDs from the grouped collection. |
Method | exclude |
Excludes the specified labels from the collection. |
Method | exists |
Returns a view containing the samples in the collection that have (or do not have) a non-None value for the given field or embedded field. |
Method | export |
Exports the samples in the collection to disk. |
Method | filter |
Filters the values of a field or embedded field of each sample in the collection. |
Method | filter |
Filters the individual fiftyone.core.labels.Keypoint.points elements in the specified keypoints field of each sample in the collection. |
Method | filter |
Filters the fiftyone.core.labels.Label field of each sample in the collection. |
Method | first |
Returns the first sample in the collection. |
Method | flatten |
Returns a flattened view that contains all samples in the dynamic grouped collection. |
Method | geo |
Sorts the samples in the collection by their proximity to a specified geolocation. |
Method | geo |
Filters the samples in this collection to only include samples whose geolocation is within a specified boundary. |
Method | get |
Returns information about the annotation run with the given key on this collection. |
Method | get |
Returns information about the brain method run with the given key on this collection. |
Method | get |
Gets the classes list for the given field, or None if no classes are available. |
Method | get |
Returns a schema dictionary describing the dynamic fields of the samples in the collection. |
Method | get |
Returns a schema dictionary describing the dynamic fields of the frames in the collection. |
Method | get |
Returns information about the evaluation with the given key on this collection. |
Method | get |
Returns the field instance of the provided path, or None if one does not exist. |
Method | get |
Returns a dictionary of information about the indexes on this collection. |
Method | get |
Gets the mask targets for the given field, or None if no mask targets are available. |
Method | get |
Returns information about the run with the given key on this collection. |
Method | get |
Gets the keypoint skeleton for the given field, or None if no skeleton is available. |
Method | group |
Creates a view that groups the samples in the collection by a specified field or expression. |
Method | has |
Whether this collection has an annotation run with the given key. |
Method | has |
Whether this collection has a brain method run with the given key. |
Method | has |
Determines whether this collection has a classes list for the given field. |
Method | has |
Whether this collection has an evaluation with the given key. |
Method | has |
Determines whether the collection has a field with the given name. |
Method | has |
Determines whether the collection has a frame-level field with the given name. |
Method | has |
Determines whether this collection has mask targets for the given field. |
Method | has |
Whether this collection has a run with the given key. |
Method | has |
Determines whether the collection has a sample field with the given name. |
Method | has |
Determines whether this collection has a keypoint skeleton for the given field. |
Method | head |
Returns a list of the first few samples in the collection. |
Method | histogram |
Computes a histogram of the field values in the collection. |
Method | init |
Initializes a config instance for a new run. |
Method | init |
Initializes a results instance for the run with the given key. |
Method | last |
Returns the last sample in the collection. |
Method | limit |
Returns a view with at most the given number of samples. |
Method | limit |
Limits the number of fiftyone.core.labels.Label instances in the specified labels list field of each sample in the collection. |
Method | list |
Returns a list of annotation keys on this collection. |
Method | list |
Returns a list of brain keys on this collection. |
Method | list |
Returns a list of evaluation keys on this collection. |
Method | list |
Returns the list of index names on this collection. |
Method | list |
Returns a list of run keys on this collection. |
Method | list |
Extracts the value type(s) in a specified list field across all samples in the collection. |
Method | load |
Loads the results for the annotation run with the given key on this collection. |
Method | load |
Loads the fiftyone.core.view.DatasetView on which the specified annotation run was performed on this collection. |
Method | load |
Downloads the labels from the given annotation run from the annotation backend and merges them into this collection. |
Method | load |
Loads the results for the brain method run with the given key on this collection. |
Method | load |
Loads the fiftyone.core.view.DatasetView on which the specified brain method run was performed on this collection. |
Method | load |
Loads the results for the evaluation with the given key on this collection. |
Method | load |
Loads the fiftyone.core.view.DatasetView on which the specified evaluation was performed on this collection. |
Method | load |
Loads the results for the run with the given key on this collection. |
Method | load |
Loads the fiftyone.core.view.DatasetView on which the specified run was performed on this collection. |
Method | make |
Makes a unique field name with the given root name for the collection. |
Method | map |
Maps the label values of a fiftyone.core.labels.Label field to new values for each sample in the collection. |
Method | match |
Filters the samples in the collection by the given filter. |
Method | match |
Filters the frames in the video collection by the given filter. |
Method | match |
Selects the samples from the collection that contain (or do not contain) at least one label that matches the specified criteria. |
Method | match |
Returns a view containing the samples in the collection that have or don't have any/all of the given tag(s). |
Method | max |
Computes the maximum of a numeric field of the collection. |
Method | mean |
Computes the arithmetic mean of the field values of the collection. |
Method | merge |
Merges the labels from the given input field into the given output field of the collection. |
Method | min |
Computes the minimum of a numeric field of the collection. |
Method | mongo |
Adds a view stage defined by a raw MongoDB aggregation pipeline. |
Method | one |
Returns a single sample in this collection matching the expression. |
Method | quantiles |
Computes the quantile(s) of the field values of a collection. |
Method | register |
Registers a run under the given key on this collection. |
Method | rename |
Replaces the key for the given annotation run with a new key. |
Method | rename |
Replaces the key for the given brain run with a new key. |
Method | rename |
Replaces the key for the given evaluation with a new key. |
Method | rename |
Replaces the key for the given run with a new key. |
Method | save |
Returns a context that can be used to save samples from this collection according to a configurable batching strategy. |
Method | save |
Saves run results for the run with the given key. |
Method | schema |
Extracts the names and types of the attributes of a specified embedded document field across all samples in the collection. |
Method | select |
Selects the samples with the given IDs from the collection. |
Method | select |
Selects the samples with the given field values from the collection. |
Method | select |
Selects only the fields with the given names from the samples in the collection. All other fields are excluded. |
Method | select |
Selects the frames with the given IDs from the video collection. |
Method | select |
Selects the samples in the group collection from the given slice(s). |
Method | select |
Selects the groups with the given IDs from the grouped collection. |
Method | select |
Selects only the specified labels from the collection. |
Method | set |
Sets a field or embedded field on each sample in a collection by evaluating the given expression. |
Method | set |
Sets the fields of the specified labels in the collection to the given values. |
Method | set |
Sets the field or embedded field on each sample or frame in the collection to the given values. |
Method | shuffle |
Randomly shuffles the samples in the collection. |
Method | skip |
Omits the given number of samples from the head of the collection. |
Method | sort |
Sorts the samples in the collection by the given field(s) or expression(s). |
Method | sort |
Sorts the collection by similarity to a specified query. |
Method | split |
Splits the labels from the given input field into the given output field of the collection. |
Method | stats |
Returns stats about the collection on disk. |
Method | std |
Computes the standard deviation of the field values of the collection. |
Method | sum |
Computes the sum of the field values of the collection. |
Method | sync |
Syncs the last_modified_at property(s) of the dataset. |
Method | tag |
Adds the tag(s) to all labels in the specified label field(s) of this collection, if necessary. |
Method | tag |
Adds the tag(s) to all samples in this collection, if necessary. |
Method | tail |
Returns a list of the last few samples in the collection. |
Method | take |
Randomly samples the given number of samples from the collection. |
Method | to |
Creates a view that contains one sample per clip defined by the given field or expression in the video collection. |
Method | to |
Creates a view based on the results of the evaluation with the given key that contains one sample for each true positive, false positive, and false negative example in the collection, respectively. |
Method | to |
Creates a view that contains one sample per frame in the video collection. |
Method | to |
Returns a JSON string representation of the collection. |
Method | to |
Creates a view that contains one sample per object patch in the specified field of the collection. |
Method | to |
Creates a view that contains one clip for each unique object trajectory defined by their (label, index) in a frame-level field of a video collection. |
Method | untag |
Removes the tag from all labels in the specified label field(s) of this collection, if necessary. |
Method | untag |
Removes the tag(s) from all samples in this collection, if necessary. |
Method | update |
Updates the run config for the run with the given key. |
Method | validate |
Validates that the collection has a field of the given type. |
Method | validate |
Validates that the collection has field(s) with the given name(s). |
Method | values |
Extracts the values of a field from all samples in the collection. |
Method | write |
Writes the colllection to disk in JSON format. |
Property | has |
Whether this collection has any annotation runs. |
Property | has |
Whether this collection has any brain runs. |
Property | has |
Whether this collection has any evaluation results. |
Property | has |
Whether this collection has any runs. |
Async Method | _async |
Undocumented |
Method | _build |
Undocumented |
Method | _build |
Undocumented |
Method | _build |
Undocumented |
Method | _build |
Undocumented |
Method | _contains |
Undocumented |
Method | _contains |
Undocumented |
Method | _delete |
Undocumented |
Method | _do |
Undocumented |
Method | _edit |
Undocumented |
Method | _edit |
Undocumented |
Method | _expand |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Computes the total size of the frame documents in the collection. |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Returns a dictionary mapping frame IDs to document sizes (in bytes) for each frame in the video collection. |
Method | _get |
Returns a dictionary mapping sample IDs to document sizes (in bytes) for each sample in the collection. |
Method | _get |
Returns a dictionary mapping sample IDs to total frame document sizes (in bytes) for each sample in the video collection. |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Computes the total size of the sample documents in the collection. |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _handle |
Undocumented |
Method | _handle |
Undocumented |
Method | _handle |
Undocumented |
Method | _handle |
Undocumented |
Method | _handle |
Undocumented |
Method | _has |
Undocumented |
Method | _has |
Undocumented |
Method | _has |
Undocumented |
Method | _is |
Undocumented |
Method | _is |
Undocumented |
Method | _is |
Undocumented |
Method | _is |
Undocumented |
Method | _is |
Undocumented |
Method | _is |
Undocumented |
Method | _list |
Undocumented |
Method | _make |
Undocumented |
Method | _make |
Undocumented |
Method | _max |
Undocumented |
Method | _min |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _process |
Undocumented |
Method | _serialize |
Undocumented |
Method | _serialize |
Undocumented |
Method | _serialize |
Undocumented |
Method | _serialize |
Undocumented |
Method | _serialize |
Undocumented |
Method | _serialize |
Undocumented |
Method | _serialize |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Method | _set |
Undocumented |
Method | _split |
Undocumented |
Method | _sync |
Undocumented |
Method | _sync |
Undocumented |
Method | _tag |
Undocumented |
Method | _to |
Undocumented |
Method | _untag |
Undocumented |
Method | _unwind |
Undocumented |
Method | _validate |
Undocumented |
Constant | _FRAMES |
Undocumented |
Constant | _GROUPS |
Undocumented |
Property | _element |
Undocumented |
Property | _elements |
Undocumented |
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
Deletes all samples in the view from the underlying dataset.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Clears the values of the frame-level field from all samples in the view.
The field will remain in the dataset's frame schema, and all frames in the view will have the value None for the field.
You can use dot notation (embedded.field.name) to clear embedded frame fields.
Only applicable to views that contain videos.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Warning
If the field name you specify is an embedded field, be aware that this operation will save the entire top-level field after clearing the field, which may result in data modification/loss if this view modifies the field in any other ways.
Parameters | |
field | the field name or embedded.field.name |
Clears the values of the frame-level fields from all samples in the view.
The fields will remain in the dataset's frame schema, and all frames in the view will have the value None for the fields.
You can use dot notation (embedded.field.name) to clear embedded frame fields.
Only applicable to views that contain videos.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Warning
If any of the field names you specify are embedded fields, be aware that this operation will save the entire top-level field after clearing the fields, which may result in data modification/loss if this view modifies these fields in any other ways.
Parameters | |
field | the field name or iterable of field names |
Deletes all frame labels from the samples in the view from the underlying dataset.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Clears the values of the field from all samples in the view.
The field will remain in the dataset's schema, and all samples in the view will have the value None for the field.
You can use dot notation (embedded.field.name) to clear embedded fields.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Warning
If the field name you specify is an embedded field, be aware that this operation will save the entire top-level field after clearing the field, which may result in data modification/loss if this view modifies the field in any other ways.
Parameters | |
field | the field name or embedded.field.name |
Clears the values of the fields from all samples in the view.
The fields will remain in the dataset's schema, and all samples in the view will have the value None for the fields.
You can use dot notation (embedded.field.name) to clear embedded fields.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Warning
If any of the field names you specify are embedded fields, be aware that this operation will save the entire top-level field after clearing the fields, which may result in data modification/loss if this view modifies these fields in any other ways.
Parameters | |
field | the field name or iterable of field names |
Creates a new dataset containing a copy of the contents of the view.
Dataset clones contain deep copies of all samples and dataset-level information in the source collection. The source media files, however, are not copied.
Parameters | |
name:None | a name for the cloned dataset. By default,
get_default_dataset_name is used |
persistent:False | whether the cloned dataset should be persistent |
Returns | |
the new fiftyone.core.dataset.Dataset |
Clones the frame-level field of the view into a new field.
You can use dot notation (embedded.field.name) to clone embedded frame fields.
Only applicable to views that contain videos.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Warning
If new_field_name is an embedded field, be aware that this operation will save the entire top-level field of new_field_name after performing the clone, which may result in data modification/loss if this view modifies this field in any other ways.
Parameters | |
field | the field name or embedded.field.name |
new | the new field name or embedded.field.name |
Clones the frame-level fields of the view into new frame-level fields of the dataset.
You can use dot notation (embedded.field.name) to clone embedded frame fields.
Only applicable to views that contain videos.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Warning
If any of the new field names to specify are embedded fields, be aware that this operation will save the entire top-level new fields after performing the clone, which may result in data modification/loss if this view modifies these fields in any other ways.
Parameters | |
field | a dict mapping field names to new field names into which to clone each field |
Clones the given sample field of the view into a new field of the dataset.
You can use dot notation (embedded.field.name) to clone embedded fields.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Warning
If new_field_name is an embedded field, be aware that this operation will save the entire top-level field of new_field_name after performing the clone, which may result in data modification/loss if this view modifies this field in any other ways.
Parameters | |
field | the field name or embedded.field.name |
new | the new field name or embedded.field.name |
Clones the given sample fields of the view into new fields of the dataset.
You can use dot notation (embedded.field.name) to clone embedded fields.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Warning
If any of the new field names to specify are embedded fields, be aware that this operation will save the entire top-level new fields after performing the clone, which may result in data modification/loss if this view modifies these fields in any other ways.
Parameters | |
field | a dict mapping field names to new field names into which to clone each field |
Ensures that the video view contains frame instances for every frame of each sample's source video.
Empty frames will be inserted for missing frames, and already existing frames are left unchanged.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Returns a view containing the samples from a dynamic grouped view with the given group value.
Examples:
import fiftyone as fo import fiftyone.zoo as foz dataset = foz.load_zoo_dataset("cifar10", split="test") view = dataset.take(1000).group_by("ground_truth.label") group = view.get_dynamic_group("cat") print(len(group)) # 104
Parameters | |
group | the group value |
Returns | |
a DatasetView |
Returns a schema dictionary describing the fields of the samples in the view.
Parameters | |
ftype:None | an optional field type or iterable of 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 |
Returns a schema dictionary describing the fields of the frames of the samples in the view.
Only applicable for views that contain videos.
Parameters | |
ftype:None | an optional field type or iterable of 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, or None if the view does not contain videos |
Returns a dict containing the samples for the given group ID.
Examples:
import fiftyone as fo import fiftyone.zoo as foz dataset = foz.load_zoo_dataset("quickstart-groups") view = dataset.select_fields() group_id = view.take(1).first().group.id group = view.get_group(group_id) print(group.keys()) # ['left', 'right', 'pcd']
Parameters | |
group | a group ID |
groupNone | an optional subset of group slices to load |
Returns | |
a dict mapping group names to
fiftyone.core.sample.SampleView instances | |
Raises | |
KeyError | if the group ID is not found |
Returns an iterator over the dynamic groups in the view.
Examples:
import fiftyone as fo import fiftyone.zoo as foz dataset = foz.load_zoo_dataset("cifar10", split="test") view = dataset.take(1000).group_by("ground_truth.label") for group in view.iter_dynamic_groups(): group_value = group.first().ground_truth.label print("%s: %d" % (group_value, len(group)))
Parameters | |
progress:False | whether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead |
Returns | |
an iterator that emits DatasetView instances, one per
group |
Returns an iterator over the groups in the view.
Examples:
import random as r import string as s import fiftyone as fo import fiftyone.zoo as foz dataset = foz.load_zoo_dataset("quickstart-groups") view = dataset.select_fields() def make_label(): return "".join(r.choice(s.ascii_letters) for i in range(10)) # No save context for group in view.iter_groups(progress=True): for sample in group.values(): sample["test"] = make_label() sample.save() # Save using default batching strategy for group in view.iter_groups(progress=True, autosave=True): for sample in group.values(): sample["test"] = make_label() # Save in batches of 10 for group in view.iter_groups( progress=True, autosave=True, batch_size=10 ): for sample in group.values(): sample["test"] = make_label() # Save every 0.5 seconds for group in view.iter_groups( progress=True, autosave=True, batch_size=0.5 ): for sample in group.values(): sample["test"] = make_label()
Parameters | |
groupNone | an optional subset of group slices to load |
progress:False | whether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead |
autosave:False | whether to automatically save changes to samples emitted by this iterator |
batchNone | the batch size to use when autosaving samples. If a batching_strategy is provided, this parameter configures the strategy as described below. If no batching_strategy is provided, this can either be an integer specifying the number of samples to save in a batch (in which case batching_strategy is implicitly set to "static") or a float number of seconds between batched saves (in which case batching_strategy is implicitly set to "latency") |
batchingNone | the batching strategy to use for each save operation when autosaving samples. Supported values are:
By default, fo.config.default_batcher is used |
Returns | |
an iterator that emits dicts mapping slice names to
fiftyone.core.sample.SampleView instances, one per group |
Returns an iterator over the samples in the view.
Examples:
import random as r import string as s import fiftyone as fo import fiftyone.zoo as foz dataset = foz.load_zoo_dataset("cifar10", split="test") view = dataset.shuffle().limit(5000) def make_label(): return "".join(r.choice(s.ascii_letters) for i in range(10)) # No save context for sample in view.iter_samples(progress=True): sample.ground_truth.label = make_label() sample.save() # Save using default batching strategy for sample in view.iter_samples(progress=True, autosave=True): sample.ground_truth.label = make_label() # Save in batches of 10 for sample in view.iter_samples( progress=True, autosave=True, batch_size=10 ): sample.ground_truth.label = make_label() # Save every 0.5 seconds for sample in view.iter_samples( progress=True, autosave=True, batch_size=0.5 ): sample.ground_truth.label = make_label()
Parameters | |
progress:False | whether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead |
autosave:False | whether to automatically save changes to samples emitted by this iterator |
batchNone | the batch size to use when autosaving samples. If a batching_strategy is provided, this parameter configures the strategy as described below. If no batching_strategy is provided, this can either be an integer specifying the number of samples to save in a batch (in which case batching_strategy is implicitly set to "static") or a float number of seconds between batched saves (in which case batching_strategy is implicitly set to "latency") |
batchingNone | the batching strategy to use for each save operation when autosaving samples. Supported values are:
By default, fo.config.default_batcher is used |
Returns | |
an iterator over fiftyone.core.sample.SampleView instances |
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Deletes all samples that are not in the view from the underlying dataset.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Deletes all fields that are excluded from the view from the underlying dataset.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
For each sample in the view, deletes all frames labels that are not in the view from the underlying dataset.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Reloads the view.
Note that fiftyone.core.sample.SampleView
instances are not
singletons, so any in-memory samples extracted from this view will not
be updated by calling this method.
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Saves the contents of the view to the database.
This method does not delete samples or frames from the underlying dataset that this view excludes.
Note
This method is not a fiftyone.core.stages.ViewStage
;
it immediately writes the requested changes to the underlying
dataset.
Warning
If a view has excluded fields or filtered list values, this method will permanently delete this data from the dataset, unless fields is used to omit such fields from the save.
Parameters | |
fields:None | an optional field or iterable of fields to save. If specified, only these field's contents are modified |
Returns a JSON dictionary representation of the view.
Parameters | |
relNone | a relative directory to remove from the
filepath of each sample, if possible. The path is converted
to an absolute path (if necessary) via
fiftyone.core.storage.normalize_path . The typical use
case for this argument is that your source data lives in a
single directory and you wish to serialize relative, rather
than absolute, paths to the data within that directory |
includeFalse | whether to include private fields |
includeFalse | whether to include the frame labels for video samples |
frameNone | a directory in which to write per-sample JSON files containing the frame labels for video samples. If omitted, frame labels will be included directly in the returned JSON dict (which can be quite quite large for video datasets containing many frames). Only applicable to datasets that contain videos when include_frames is True |
prettyFalse | whether to render frame labels JSON in human readable format with newlines and indentations. Only applicable to datasets that contain videos when a frame_labels_dir is provided |
Returns | |
a JSON dict |
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
Dataset-specific settings that customize how this collection is visualized in the :ref:`FiftyOne App <fiftyone-app>`.
The classes of the underlying dataset.
See fiftyone.core.dataset.Dataset.classes
for more information.
The default classes of the underlying dataset.
See fiftyone.core.dataset.Dataset.default_classes
for more
information.
The default mask targets of the underlying dataset.
See fiftyone.core.dataset.Dataset.default_mask_targets
for more
information.
The default keypoint skeleton of the underlying dataset.
See fiftyone.core.dataset.Dataset.default_skeleton
for more
information.
A description of the underlying dataset.
See fiftyone.core.dataset.Dataset.description
for more
information.
The info dict of the underlying dataset.
See fiftyone.core.dataset.Dataset.info
for more information.
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Whether the view is a saved view or not.
The mask targets of the underlying dataset.
See fiftyone.core.dataset.Dataset.mask_targets
for more
information.
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
The media type of the view.
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
The name of the view if it is a saved view; otherwise None.
The keypoint skeletons of the underlying dataset.
See fiftyone.core.dataset.Dataset.skeletons
for more
information.
The list of tags of the underlying dataset.
See fiftyone.core.dataset.Dataset.tags
for more information.
Returns a fiftyone.core.view.DatasetView
containing the
contents of the collection with the given
fiftyone.core.stages.ViewStage` appended to its aggregation
pipeline.
Subclasses are responsible for performing any validation on the view stage to ensure that it is a valid stage to add to this collection.
Parameters | |
stage | a fiftyone.core.stages.ViewStage` |
validate | Undocumented |
Returns | |
a fiftyone.core.view.DatasetView |
Runs the MongoDB aggregation pipeline on the collection and returns the result.
Parameters | |
pipeline:None | a MongoDB aggregation pipeline (list of dicts) to append to the current pipeline |
mediaNone | the media type of the collection, if different than the source dataset's media type |
attachFalse | whether to attach the frame documents immediately prior to executing pipeline. Only applicable to datasets that contain videos |
detachFalse | whether to detach the frame documents at the end of the pipeline. Only applicable to datasets that contain videos |
framesFalse | whether to generate a pipeline that contains only the frames in the collection |
support:None | an optional [first, last] range of frames to attach. Only applicable when attaching frames |
groupNone | the current group slice of the collection, if different than the source dataset's group slice. Only applicable for grouped collections |
groupNone | an optional list of group slices to attach when groups_only is True |
detachFalse | whether to detach the group documents at the end of the pipeline. Only applicable to grouped collections |
groupsFalse | whether to generate a pipeline that contains only the flattened group documents for the collection |
manualFalse | whether the pipeline has manually handled the initial group selection. Only applicable to grouped collections |
postNone | a MongoDB aggregation pipeline (list of dicts) to append to the very end of the pipeline, after all other arguments are applied |
Returns | |
the aggregation result dict |
Returns the MongoDB aggregation pipeline for the collection.
Parameters | |
pipeline:None | a MongoDB aggregation pipeline (list of dicts) to append to the current pipeline |
mediaNone | the media type of the collection, if different than the source dataset's media type |
attachFalse | whether to attach the frame documents immediately prior to executing pipeline. Only applicable to datasets that contain videos |
detachFalse | whether to detach the frame documents at the end of the pipeline. Only applicable to datasets that contain videos |
framesFalse | whether to generate a pipeline that contains only the frames in the collection |
support:None | an optional [first, last] range of frames to attach. Only applicable when attaching frames |
groupNone | the current group slice of the collection, if different than the source dataset's group slice. Only applicable for grouped collections |
groupNone | an optional list of group slices to attach when groups_only is True |
detachFalse | whether to detach the group documents at the end of the pipeline. Only applicable to grouped collections |
groupsFalse | whether to generate a pipeline that contains only the flattened group documents for the collection |
manualFalse | whether the pipeline has manually handled the initial group selection. Only applicable to grouped collections |
postNone | a MongoDB aggregation pipeline (list of dicts) to append to the very end of the pipeline, after all other arguments are applied |
Returns | |
the aggregation pipeline |
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
The fiftyone.core.dataset.Dataset
that serves the samples
in this collection.
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
The root fiftyone.core.dataset.Dataset
from which this
collection is derived.
This is typically the same as _dataset
but may differ in cases
such as patches views.
fiftyone.core.clips.ClipsView
, fiftyone.core.video.FramesView
, fiftyone.core.patches._PatchesView
Undocumented