Utilities for working with datasets in COCO format.
Class |
|
Exporter that writes COCO detection datasets to disk. |
Class |
|
Importer for COCO detection datasets stored on disk. |
Class |
|
An object in COCO format. |
Function | add |
Adds the given COCO labels to the collection. |
Function | download |
Utility that downloads full or partial splits of the COCO dataset. |
Function | load |
Loads the COCO annotations from the given JSON file. |
Function | parse |
Parses the COCO categories list. |
Variable | logger |
Undocumented |
Variable | mask |
Undocumented |
Function | _close |
Undocumented |
Function | _coco |
Undocumented |
Function | _coco |
Undocumented |
Function | _coco |
Undocumented |
Function | _coco |
Undocumented |
Function | _do |
Undocumented |
Function | _download |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _instance |
Undocumented |
Function | _load |
Undocumented |
Function | _load |
Undocumented |
Function | _load |
Undocumented |
Function | _make |
Undocumented |
Function | _mask |
Undocumented |
Function | _mask |
Undocumented |
Function | _merge |
Undocumented |
Function | _normalize |
Undocumented |
Function | _pairwise |
Undocumented |
Function | _parse |
Undocumented |
Function | _parse |
Undocumented |
Function | _parse |
Undocumented |
Function | _parse |
Undocumented |
Function | _parse |
Undocumented |
Function | _polyline |
Undocumented |
Function | _to |
Undocumented |
Function | _to |
Undocumented |
Function | _write |
Undocumented |
Constant | _ANNOTATION |
Undocumented |
Constant | _ANNOTATION |
Undocumented |
Constant | _CSV |
Undocumented |
Constant | _IMAGE |
Undocumented |
Constant | _KEYPOINTS |
Undocumented |
Constant | _SPLIT |
Undocumented |
Constant | _SUPPORTED |
Undocumented |
Constant | _SUPPORTED |
Undocumented |
Constant | _TEST |
Undocumented |
Constant | _TEST |
Undocumented |
Adds the given COCO labels to the collection.
The labels_or_path argument can be any of the following:
- a list of COCO annotations in the format below
- the path to a JSON file containing a list of COCO annotations
- the path to a JSON file whose "annotations" key contains a list of COCO annotations
When label_type="detections", the labels should have format:
[ { "id": 1, "image_id": 1, "category_id": 1, "bbox": [260, 177, 231, 199], # optional "score": 0.95, "area": 45969, "iscrowd": 0, # extra attrs ... }, ... ]
When label_type="segmentations", the labels should have format:
[ { "id": 1, "image_id": 1, "category_id": 1, "bbox": [260, 177, 231, 199], "segmentation": [...], # optional "score": 0.95, "area": 45969, "iscrowd": 0, # extra attrs ... }, ... ]
When label_type="keypoints", the labels should have format:
[ { "id": 1, "image_id": 1, "category_id": 1, "keypoints": [224, 226, 2, ...], "num_keypoints": 10, # extra attrs ... }, ... ]
See this page for more information about the COCO data format.
Parameters | |
sample | a
fiftyone.core.collections.SampleCollection |
label | the label field in which to store the labels. The field will be created if necessary |
labels | a list of COCO annotations or the path to a JSON file containing such data on disk |
categories | can be any of the following:
|
label | the type of labels to load. Supported values are ("detections", "segmentations", "keypoints") |
cocoNone | this parameter determines how to map the predictions onto samples in sample_collection. The supported values are:
|
includeFalse | whether to include the COCO ID of each annotation in the loaded labels |
extraTrue | whether to load extra annotation attributes onto the imported labels. Supported values are:
|
useFalse | whether to represent segmentations as
fiftyone.core.labels.Polylines instances rather than
fiftyone.core.labels.Detections with dense masks |
tolerance:None | a tolerance, in pixels, when generating approximate polylines for instance masks. Typical values are 1-3 pixels |
Utility that downloads full or partial splits of the COCO dataset.
See :ref:`this page <COCODetectionDataset-export>` for the format in which dataset_dir will be arranged.
Any existing files are not re-downloaded.
Parameters | |
dataset | the directory to download the dataset |
split | the split to download. Supported values are ("train", "validation", "test") |
year:"2017" | the dataset year to download. Supported values are ("2014", "2017") |
labelNone | a label type or list of label types to load. The supported values are ("detections", "segmentations"). By default, all label types are loaded |
classes:None | a string or list of strings specifying required classes to load. Only samples containing at least one instance of a specified class will be loaded |
imageNone | an optional list of specific image IDs to load. Can be provided in any of the following formats:
|
numNone | a suggested number of threads to use when downloading individual images |
shuffle:False | whether to randomly shuffle the order in which samples are chosen for partial downloads |
seed:None | a random seed to use when shuffling |
maxNone | a maximum number of samples to load. If label_types and/or classes are also specified, first priority will be given to samples that contain all of the specified label types and/or classes, followed by samples that contain at least one of the specified labels types or classes. The actual number of samples loaded may be less than this maximum value if the dataset does not contain sufficient samples matching your requirements. By default, all matching samples are loaded |
rawNone | a directory in which full annotations files may be stored to avoid re-downloads in the future |
scratchNone | a scratch directory to use to download any necessary temporary files |
Returns | |
a tuple of |
|
Loads the COCO annotations from the given JSON file.
See :ref:`this page <COCODetectionDataset-import>` for format details.
Parameters | |
json | the path to the annotations JSON file |
extraTrue | whether to load extra annotation attributes. Supported values are:
|
Returns | |
a tuple of |
|
Parses the COCO categories list.
Parameters | |
categories | a list of dict of the form: [ ... { "id": 2, "name": "cat", "supercategory": "animal", "keypoints": ["nose", "head", ...], "skeleton": [[12, 14], [14, 16], ...] }, ... ] |
Returns | |
a tuple of |
|
Undocumented
Undocumented
Undocumented
Undocumented
Undocumented
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|