pip install fiftyone import fiftyone as fo★Bundles a local MongoDB. First launch initializes the database.dataset = fo.Dataset("my-data", persistent=True)★Persistent datasets survive process exit (stored in the DB). Without it, the dataset is deleted when you quit.fo.list_datasets() · fo.load_dataset("my-data") · dataset.delete()★Datasets are named & reloadable by name across sessions.len(dataset) · dataset.first() · dataset.stats() · dataset.head()Inspect size, peek at samples, see storage stats.
s = fo.Sample(filepath="/data/img.jpg") dataset.add_sample(s)★A Sample = a media file + arbitrary fields. Add fields (labels, metadata, tags) as attributes.s["ground_truth"] = fo.Detections(detections=[ fo.Detection(label="cat", bounding_box=[0.1,0.1,0.3,0.4])])★Bounding boxes are normalized[x, y, w, h]in [0,1]. A field can hold any label type.fo.Classification(label=...) · fo.Segmentation(mask=...) · fo.Keypoints · fo.Polylines★The label types — classifications, detections, masks, keypoints, polylines (and 3D). Store GT & predictions in different fields.s.tags.append("train") · s["weather"] = "rain" · s.save()Tags & custom fields for filtering. Callsave()after editing a sample fetched from the DB.
dataset = fo.Dataset.from_dir( dataset_dir="/data", dataset_type=fo.types.COCODetectionDataset)★Import from a standard layout. Types:COCODetectionDataset,YOLOv5Dataset,ImageClassificationDirectoryTree,VOCDetectionDataset, ...dataset.add_images_dir("/data/images") # images only, no labelsOradd_images_pattwith a glob. Then attach predictions programmatically.dataset.compute_metadata() # width/height/size per samplePopulate media metadata for filtering (e.g. by resolution).