hello.fiftyone.dataset module¶
- hello.fiftyone.dataset.add_coco_labels(dataset, label_field, labels_path, label_type='detections')[source]¶
- hello.fiftyone.dataset.add_dataset(dataset, skip_existing=True, insert_new=True, fields=None, expand_schema=True)[source]¶
- hello.fiftyone.dataset.add_dataset_dir(dataset_dir, data_path=None, labels_path=None, label_field=None, tags=None)[source]¶
- hello.fiftyone.dataset.add_detection_labels(dataset, label_field, labels_path, classes=None, mode='text', remove_prefix=False)[source]¶
Adds detection labels to the dataset.
Note
if
mode=text, a text row corresponds to a sample prediction result. row format:filepath,height,width,x1,y1,x2,y2,s,l,x1,y1,x2,y2,s,l.if
mode=yolo, a txt file corresponds to a sample prediction result. row format:target,xc,yc,w,h,s.if
mode=coco, a standard COCO format json file. from https://cocodataset.org/#format-data.- Parameters:
dataset – a
fiftyone.core.dataset.Datasetlabel_field (str) – the label field in which to store the labels
labels_path (str) – the labels load from
classes (list) – the list of class label strings
mode (str) – supported values are
("text", "yolo", "coco")
- hello.fiftyone.dataset.add_images_dir(dataset, images_dir, tags=None, recursive=True)[source]¶
Adds the given directory of images to the dataset.
- Parameters:
dataset – a
fiftyone.core.dataset.Datasetimages_dir (str) – a directory of images
tags (None) – an optional tag or iterable of tags to attach to each sample
recursive (True) – whether to recursively traverse subdirectories
- hello.fiftyone.dataset.add_segmentation_labels(dataset, label_field, labels_path, mask_targets='auto', mode='png')[source]¶
Adds segmentation labels to the dataset.
- Parameters:
dataset – a
fiftyone.core.dataset.Datasetlabel_field (str) – the label field in which to store the labels
labels_path (str) – the labels load from
mask_targets (dict) – a dict mapping pixel values to semantic label strings
mode (str) – supported values are
("png", "coco")
- hello.fiftyone.dataset.create_dataset(dataset_name, dataset_type, version='001', classes=[], mask_targets={}, force=False)[source]¶
Create an empty
fiftyone.core.dataset.Datasetwith the name.- Parameters:
dataset_name (str) – a name for the dataset
dataset_type (str) – supported values are
("detection", "segmentation", "unknown")classes (list, optional) – defaults to
[]mask_targets (dict, optional) – defaults to
{}
- Returns:
a
fiftyone.core.dataset.Dataset
- hello.fiftyone.dataset.delete_duplicate_images(dataset)[source]¶
Delete duplicate images.
- Parameters:
dataset – a
fiftyone.core.dataset.Dataset
- hello.fiftyone.dataset.delete_duplicate_labels(dataset, label_field, iou_thresh=0.999, method='simple', iscrowd=None, classwise=True)[source]¶
Delete duplicate labels in the given field of the dataset, as defined as labels with an IoU greater than a chosen threshold with another label in the field.
- Parameters:
dataset – a
fiftyone.core.dataset.Datasetlabel_field – a label field of type
fiftyone.core.labels.Detectionsorfiftyone.core.labels.Polylinesiou_thresh (0.999) – the IoU threshold to use to determine whether labels are duplicates
method ("simple") – supported values are
("simple", "greedy")iscrowd (None) – an optional name of a boolean attribute
classwise (True) – different label values as always non-overlapping
- hello.fiftyone.dataset.export_classification_dataset(export_dir, dataset, label_field, splits=None, export_media=True)[source]¶
- hello.fiftyone.dataset.export_classification_labels(export_dir, dataset, label_field, splits=None)[source]¶
- hello.fiftyone.dataset.export_dataset(export_dir, dataset, label_field=None, mask_label_field=None, mask_types='stuff', splits=None)[source]¶
Exports the samples in the collection to disk.
- Parameters:
export_dir – the directory to which to export the samples
dataset – a
fiftyone.core.collections.SampleCollectionlabel_field – controls the label field(s) to export
mask_label_field – controls the label field(s) to export
mask_types ("stuff") – “stuff”(amorphous regions of pixels), “thing”(connected regions, each representing an instance)
splits (None) – a list of strings, respectively, specifying the splits to load. If “auto” will computes the distinct tags
- hello.fiftyone.dataset.export_detection_dataset(export_dir, dataset, label_field, splits=None)[source]¶
- hello.fiftyone.dataset.export_segmentation_dataset(export_dir, dataset, label_field, mask_types='stuff', splits=None)[source]¶
- hello.fiftyone.dataset.load_dataset(name)[source]¶
Loads the FiftyOne dataset with the given name.
- Parameters:
name (str) – the name of the dataset
- hello.fiftyone.dataset.load_images_dir(dataset_dir, dataset_name, dataset_type, version='001', classes=[], mask_targets={})[source]¶
Create a
fiftyone.core.dataset.Datasetfrom the given directory of images.- Parameters:
dataset_dir (str) – a directory of images
dataset_name (str) – a name for the dataset
dataset_type (str) – supported values are
("detection", "segmentation", "unknown")classes (list, optional) – defaults to
[]mask_targets (dict, optional) – defaults to
{}
- Returns:
a
fiftyone.core.dataset.Dataset