Utilities for working with annotations in Labelbox format.
Class |
|
A class to facilitate connection to and management of projects in Labelbox. |
Class |
|
Class that stores all relevant information needed to monitor the progress of an annotation run sent to Labelbox and download the results. |
Class |
|
Class for interacting with the Labelbox annotation backend. |
Class |
|
Class for configuring LabelboxBackend instances. |
Class |
|
Enum for Labelbox export formats and API versions. |
Function | convert |
Converts a Labelbox NDJSON export generated by export_to_labelbox into the format expected by import_from_labelbox . |
Function | download |
Downloads the labels for the given Labelbox project. |
Function | export |
Exports labels from the FiftyOne samples to Labelbox format. |
Function | import |
Imports the labels from the Labelbox project into the FiftyOne dataset. |
Function | upload |
Uploads labels to a Labelbox project. |
Function | upload |
Uploads the raw media for the FiftyOne samples to Labelbox. |
Variable | lb |
Undocumented |
Variable | lbo |
Undocumented |
Variable | lbr |
Undocumented |
Variable | lbs |
Undocumented |
Variable | logger |
Undocumented |
Class | _ |
Undocumented |
Class | _ |
Undocumented |
Class | _ |
Undocumented |
Class | _ |
Undocumented |
Function | _convert |
Undocumented |
Function | _download |
Undocumented |
Function | _download |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _ingest |
Undocumented |
Function | _make |
Undocumented |
Function | _parse |
Undocumented |
Function | _warn |
Undocumented |
Constant | _UNIQUE |
Undocumented |
Converts a Labelbox NDJSON export generated by
export_to_labelbox
into the format expected by
import_from_labelbox
.
The output JSON file will have the same format that is generated when exporting a Labelbox project's labels.
The Labeled Data fields of the output labels will be None.
Parameters | |
inpath | the path to an NDJSON file generated (for example) by
export_to_labelbox |
outpath:None | the path to write a JSON file containing the converted labels. If omitted, the input file will be overwritten |
videoNone | a directory to write the converted video frame labels (if applicable). If omitted, the input frame label files will be overwritten |
Downloads the labels for the given Labelbox project.
Parameters | |
labelbox | a labelbox.schema.project.Project |
outpath:None | the path to write the JSON export on disk |
export | the Labelbox export format and API version to use. Supported values are ("v1", "v2") |
Returns | |
None if an outpath is provided, or the loaded JSON itself if no outpath is provided |
Exports labels from the FiftyOne samples to Labelbox format.
This function is useful for loading predictions into Labelbox for model-assisted labeling.
You can use upload_labels_to_labelbox
to upload the exported labels
to a Labelbox project.
You can use upload_media_to_labelbox
to upload sample media to
Labelbox and populate the labelbox_id_field field, if necessary.
The IDs of the Labelbox DataRows corresponding to each sample must be stored in the labelbox_id_field of the samples. Any samples with no value in labelbox_id_field will be skipped.
When exporting frame labels for video datasets, the frames key of the exported labels will contain the paths on disk to per-sample NDJSON files that are written to video_labels_dir as follows:
video_labels_dir/ <labelbox-id1>.json <labelbox-id2>.json ...
where each NDJSON file contains the frame labels for the video with the corresponding Labelbox ID.
Parameters | |
sample | a
fiftyone.core.collections.SampleCollection |
ndjson | the path to write an NDJSON export of the labels |
videoNone | a directory to write the per-sample video labels. Only applicable for video datasets |
labelbox | the sample field to lookup/store the IDs of the Labelbox DataRows |
labelNone | optional label field(s) to export. Can be any of the following:
By default, no labels are exported |
frameNone | optional frame label field(s) to export. Only applicable to video datasets. Can be any of the following:
By default, no frame labels are exported |
progress:None | whether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead |
Imports the labels from the Labelbox project into the FiftyOne dataset.
The labelbox_id_field of the FiftyOne samples are used to associate the corresponding Labelbox labels.
If a download_dir is provided, any Labelbox IDs with no matching FiftyOne sample are added to the FiftyOne dataset, and their media is downloaded into download_dir.
The provided json_path should contain a JSON file in the following format:
[ { "DataRow ID": <labelbox-id>, "Labeled Data": <url-or-None>, "Label": {...} } ]
When importing image labels, the Label field should contain a dict of Labelbox image labels:
{ "objects": [...], "classifications": [...] }
When importing video labels, the Label field should contain a dict as follows:
{ "frames": <url-or-filepath> }
where the frames field can either contain a URL, in which case the file is downloaded from the web, or the path to NDJSON file on disk of Labelbox video labels:
{"frameNumber": 1, "objects": [...], "classifications": [...]} {"frameNumber": 2, "objects": [...], "classifications": [...]} ...
Parameters | |
dataset | a fiftyone.core.dataset.Dataset |
json | the path to the Labelbox JSON export to load |
labelNone | a prefix to prepend to the sample label field(s) that are created, separated by an underscore |
downloadNone | a directory into which to download the media for any Labelbox IDs with no corresponding sample with the matching labelbox_id_field value. This can be omitted if all IDs are already present or you do not wish to download media and add new samples |
labelbox | the sample field to lookup/store the IDs of the Labelbox DataRows |
progress:None | whether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead |
Uploads labels to a Labelbox project.
Use this function to load predictions into Labelbox for model-assisted labeling.
Use export_to_labelbox
to export annotations in the format expected
by this method.
Parameters | |
labelbox | a labelbox.schema.project.Project |
annos | a list of annotation dicts or the path to an NDJSON file on disk containing annotations |
batchNone | an optional batch size to use when uploading the annotations. By default, annos_or_ndjson_path is passed directly to labelbox_project.upload_annotations() |
Uploads the raw media for the FiftyOne samples to Labelbox.
The IDs of the Labelbox DataRows that are created are stored in the labelbox_id_field of the samples.
Parameters | |
labelbox | a labelbox.schema.dataset.Dataset to which to add the media |
sample | a
fiftyone.core.collections.SampleCollection |
labelbox | the sample field in which to store the IDs of the Labelbox DataRows |
progress:None | whether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead |