module documentation

Clips views.

Copyright 2017-2025, Voxel51, Inc.

Class ClipsView A fiftyone.core.view.DatasetView of clips from a video fiftyone.core.dataset.Dataset.
Class ClipView A clip in a ClipsView.
Class TrajectoriesView A ClipsView of object trajectories from a video fiftyone.core.dataset.Dataset.
Function make_clips_dataset Creates a dataset that contains one sample per clip defined by the given field or expression in the collection.
Class _Bounds Undocumented
Function _get_label_field Undocumented
Function _get_trajectories Undocumented
Function _is_frame_support_field Undocumented
Function _make_pretty_summary Undocumented
Function _to_rle Undocumented
Function _write_expr_clips Undocumented
Function _write_manual_clips Undocumented
Function _write_support_clips Undocumented
Function _write_temporal_detection_clips Undocumented
Function _write_trajectories Undocumented
def make_clips_dataset(sample_collection, field_or_expr, other_fields=None, tol=0, min_len=0, trajectories=False, name=None, persistent=False, _generated=False): (source)

Creates a dataset that contains one sample per clip defined by the given field or expression in the collection.

The returned dataset will contain:

  • A sample_id field that records the sample ID from which each clip was taken
  • A support field that records the [first, last] frame support of each clip
  • All frame-level information from the underlying dataset of the input collection

In addition, sample-level fields will be added for certain clipping strategies:

  • When field_or_expr is a temporal detection(s) field, the field will be converted to a fiftyone.core.labels.Classification field
  • When trajectories is True, a sample-level label field will be added recording the label and index of each trajectory

Note

The returned dataset will directly use the frame collection of the input dataset.

Parameters
sample_collectiona fiftyone.core.collections.SampleCollection
field_or_expr

can be any of the following:

other_fields:None

controls whether sample fields other than the default sample fields are included. Can be any of the following:

  • a field or list of fields to include
  • True to include all other fields
  • None/False to include no other fields
tol:0the maximum number of false frames that can be overlooked when generating clips. Only applicable when field_or_expr is a frame-level list field or expression
min_len:0the minimum allowable length of a clip, in frames. Only applicable when field_or_expr is a frame-level list field or an expression
trajectories:Falsewhether to create clips for each unique object trajectory defined by their (label, index). Only applicable when field_or_expr is a frame-level field
name:Nonea name for the dataset
persistent:Falsewhether the dataset should persist in the database after the session terminates
_generatedUndocumented
Returns
a fiftyone.core.dataset.Dataset
def _get_label_field(sample_collection, field_path): (source)

Undocumented

def _get_trajectories(sample_collection, frame_field): (source)

Undocumented

def _is_frame_support_field(sample_collection, field_path): (source)

Undocumented

def _make_pretty_summary(dataset): (source)

Undocumented

def _to_rle(frame_numbers, bools, tol=0, min_len=0): (source)

Undocumented

def _write_expr_clips(dataset, src_collection, expr, other_fields=None, tol=0, min_len=0): (source)

Undocumented

def _write_manual_clips(dataset, src_collection, clips, other_fields=None): (source)

Undocumented

def _write_support_clips(dataset, src_collection, field_path, other_fields=None): (source)

Undocumented

def _write_temporal_detection_clips(dataset, src_collection, field, other_fields=None): (source)

Undocumented

def _write_trajectories(dataset, src_collection, field, other_fields=None): (source)

Undocumented