module documentation

Patches views.

Copyright 2017-2025, Voxel51, Inc.

Class EvaluationPatchesView A fiftyone.core.view.DatasetView containing evaluation patches from a fiftyone.core.dataset.Dataset.
Class EvaluationPatchView A patch in an EvaluationPatchesView.
Class PatchesView A fiftyone.core.view.DatasetView of patches from a fiftyone.core.dataset.Dataset.
Class PatchView A patch in a PatchesView.
Function make_evaluation_patches_dataset Creates a dataset 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 input collection, respectively.
Function make_patches_dataset Creates a dataset that contains one sample per object patch in the specified field of the collection.
Class _PatchesView No class docstring; 0/10 property, 0/6 instance variable, 0/1 class variable, 4/19 methods documented
Class _PatchView Undocumented
Function _add_samples Undocumented
Function _get_patches_field Undocumented
Function _make_eval_view Undocumented
Function _make_patches_view Undocumented
Function _make_pretty_summary Undocumented
Function _merge_matched_labels Undocumented
Function _upgrade_labels Undocumented
Function _write_samples Undocumented
Constant _NO_MATCH_ID Undocumented
Constant _PATCHES_TYPES Undocumented
def make_evaluation_patches_dataset(sample_collection, eval_key, other_fields=None, name=None, persistent=False, _generated=False): (source)

Creates a dataset 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 input collection, respectively.

True positive examples will result in samples with both their ground truth and predicted fields populated, while false positive/negative examples will only have one of their corresponding predicted/ground truth fields populated, respectively.

If multiple predictions are matched to a ground truth object (e.g., if the evaluation protocol includes a crowd attribute), then all matched predictions will be stored in the single sample along with the ground truth object.

The returned dataset will also have top-level type and iou fields populated based on the evaluation results for that example, as well as a sample_id field recording the sample ID of the example, and a crowd field if the evaluation protocol defines a crowd attribute.

Note

The returned dataset will contain patches for the contents of the input collection, which may differ from the view on which the eval_key evaluation was performed. This may exclude some labels that were evaluated and/or include labels that were not evaluated.

If you would like to see patches for the exact view on which an evaluation was performed, first call load_evaluation_view() to load the view and then convert to patches.

Parameters
sample_collectiona fiftyone.core.collections.SampleCollection
eval_keyan evaluation key that corresponds to the evaluation of ground truth/predicted fields that are of type fiftyone.core.labels.Detections, fiftyone.core.labels.Polylines, or fiftyone.core.labels.Keypoints
other_fields:None

controls whether fields other than the ground truth/predicted fields and 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
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 make_patches_dataset(sample_collection, field, other_fields=None, keep_label_lists=False, name=None, persistent=False, _generated=False): (source)

Creates a dataset that contains one sample per object patch in the specified field of the collection.

A sample_id field will be added that records the sample ID from which each patch was taken.

By default, fields other than field and the default sample fields will not be included in the returned dataset.

Parameters
sample_collectiona fiftyone.core.collections.SampleCollection
fieldthe patches field, which must be of type fiftyone.core.labels.Detections, fiftyone.core.labels.Polylines, or fiftyone.core.labels.Keypoints
other_fields:None

controls whether fields other than field and 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
keep_label_lists:Falsewhether to store the patches in label list fields of the same type as the input collection rather than using their single label variants
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 _add_samples(dataset, src_collection): (source)

Undocumented

def _get_patches_field(sample_collection, field_name, keep_label_lists): (source)

Undocumented

def _make_eval_view(sample_collection, eval_key, field, other_fields=None, skip_matched=False, crowd_attr=None): (source)

Undocumented

def _make_patches_view(sample_collection, field, other_fields=None, keep_label_lists=False): (source)

Undocumented

def _make_pretty_summary(dataset, is_frame_patches=False): (source)

Undocumented

def _merge_matched_labels(dataset, src_collection, eval_key, field): (source)

Undocumented

def _upgrade_labels(view, field): (source)

Undocumented

def _write_samples(dataset, src_collection): (source)

Undocumented

_NO_MATCH_ID: str = (source)

Undocumented

Value
''
_PATCHES_TYPES = (source)