hello.fiftyone.core module

hello.fiftyone.core.count_values(dataset, field_or_expr, ordered=True)[source]
hello.fiftyone.core.filter_detections_dataset(dataset, mapping=None, field_name='ground_truth', background='background')[source]

Steps: map labels -> check dataset.classes -> filter valid samples

Parameters
  • dataset (fo.Dataset) – _description_

  • mapping (dict[str, str], optional) – _description_. Defaults to None.

  • field_name (str, optional) – _description_. Defaults to “ground_truth”.

  • background (str, optional) – _description_. Defaults to “background”.

Returns

_description_

Return type

fo.Dataset

hello.fiftyone.core.filter_segmentation_dataset(dataset, new_classes=None, field_name='ground_truth', ignore_index=255)[source]

Steps: map labels -> check dataset.mask_targets -> filter valid samples

Parameters
  • dataset (fo.Dataset) – _description_

  • new_classes (list, optional) – refer to gen_mapping(). Defaults to None.

  • field_name (str, optional) – _description_. Defaults to “ground_truth”.

  • ignore_index (int, optional) – _description_. Defaults to 255.

Returns

_description_

Return type

fo.Dataset

hello.fiftyone.core.filter_segmentation_samples(out_dir, data_root, classes, mask_targets, threshold=0.05, splits=['train', 'val'], img_dir='data', ann_dir='labels', img_suffix='.jpg', seg_map_suffix='.png')[source]

Filter samples, based on area of interest ratio.

>>> <data_root>/
>>> ├── objectInfo150.txt
>>> ├── sceneCategories.txt
>>> ├── train
>>> │   ├── data
>>> │   └── labels
>>> └── val
>>>     ├── data
>>>     └── labels
Parameters
  • out_dir (str) – _description_

  • data_root (str) – _description_

  • classes (list[str]) – _description_

  • mask_targets (dict[int, str]) – _description_

  • threshold (float, optional) – _description_. Defaults to 0.05.

  • splits (list, optional) – _description_. Defaults to [“train”, “val”].

  • img_dir (str, optional) – _description_. Defaults to “data”.

  • ann_dir (str, optional) – _description_. Defaults to “labels”.

  • img_suffix (str, optional) – _description_. Defaults to “.jpg”.

  • seg_map_suffix (str, optional) – _description_. Defaults to “.png”.

hello.fiftyone.core.gen_mapping(old_classes, new_classes)[source]

generate segmentation mapping

Parameters
  • old_classes (list) – [‘c0’, ‘c1’, ‘c2’, ‘c3’, ‘c4’, ‘c5’, ‘be ignored’]

  • new_classes (list) – [‘c0’, ‘c1’, ‘c2’, [‘c3’, ‘c4’, ‘c5’], ‘be ignored’]

Returns

_description_

Return type

_type_

hello.fiftyone.core.map_default_classes(dataset, mapping, background='background')[source]
hello.fiftyone.core.map_default_mask_targets(dataset, classes, ignore_index=255)[source]
hello.fiftyone.core.map_labels(dataset, mapping, field_name='ground_truth')[source]
hello.fiftyone.core.merge_samples(datasets, **kwargs)[source]
hello.fiftyone.core.split_dataset(dataset, splits=None, limit=3000, field_name='ground_truth', from_field=None)[source]