fiftyone.utils.openlabel#
Utilities for working with datasets in OpenLABEL format.
Classes:
|
The FiftyOne label type used to store segmentations |
|
Importer for OpenLABEL image datasets stored on disk. |
|
Importer for OpenLABEL video datasets stored on disk. |
Annotations parsed from OpenLABEL format able to be converted to FiftyOne labels. |
|
|
A collection of multiple |
|
Information about a stream used to gather specific objects for a media file. |
A utility for parsing groups of OpenLABEL elements |
|
A collection of |
|
A collection of OpenLABEL streams. |
|
Methods used to parse attributes from OpenLABEL annotations. |
|
|
A single OpenLABEL shape like a bounding box or polygon. |
|
An OpenLABEL bounding box. |
|
An OpenLABEL polyline. |
|
An OpenLABEL keypoint. |
|
A collection of OpenLABEL shapes. |
|
An OpenLABEL stream corresponding to one uri or file_id. |
|
A parser and storage for OpenLABEL metadata. |
|
An object parsed from OpenLABEL labels. |
- class fiftyone.utils.openlabel.SegmentationType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
EnumThe FiftyOne label type used to store segmentations
Attributes:
- INSTANCE = 1#
- POLYLINE = 2#
- SEMANTIC = 3#
- class fiftyone.utils.openlabel.OpenLABELImageDatasetImporter(dataset_dir=None, data_path=None, labels_path=None, label_types=None, use_polylines=False, shuffle=False, seed=None, max_samples=None, skeleton=None, skeleton_key=None)#
Bases:
LabeledImageDatasetImporter,ImportPathsMixinImporter for OpenLABEL image datasets stored on disk.
See this page for format details.
- Parameters:
dataset_dir (None) – the dataset directory. If omitted,
data_pathand/orlabels_pathmust be provideddata_path (None) –
an optional parameter that enables explicit control over the location of the media. Can be any of the following:
a folder name like
"data"or"data/"specifying a subfolder ofdataset_dirwhere the media files residean absolute directory path where the media files reside. In this case, the
dataset_dirhas no effect on the location of the dataa filename like
"data.json"specifying the filename of the JSON data manifest file indataset_diran absolute filepath specifying the location of the JSON data manifest. In this case,
dataset_dirhas no effect on the location of the dataa dict mapping file_ids to absolute filepaths
If None, this parameter will default to whichever of
data/ordata.jsonexists in the dataset directorylabels_path (None) –
an optional parameter that enables explicit control over the location of the labels. Can be any of the following:
a filename like
"labels.json"specifying the location of the labels indataset_dira folder name like
"labels"or"labels/"specifying a subfolder ofdataset_dirwhere the multiple label files residean absolute filepath to the labels. In this case,
dataset_dirhas no effect on the location of the labels
If None, the parameter will default to looking for
labels.jsonandlabel/label_types (None) – a label type or list of label types to load. The supported values are
("detections", "segmentations", "keypoints"). By default, all labels are loadeduse_polylines (False) – whether to represent segmentations as
fiftyone.core.labels.Polylinesinstances rather thanfiftyone.core.labels.Detectionswith dense masksshuffle (False) – whether to randomly shuffle the order in which the samples are imported
seed (None) – a random seed to use when shuffling
max_samples (None) – a maximum number of samples to load
skeleton (None) – a
fiftyone.core.odm.dataset.KeypointSkeletonto reference when loading keypointsskeleton_key (None) – the key in the OpenLABEL annotations pointing to the label of each keypoint matching the labels defined in the given
skeleton
Attributes:
Whether this importer produces a dataset info dictionary.
Whether this importer produces
fiftyone.core.metadata.ImageMetadatainstances for each image.The
fiftyone.core.labels.Labelclass(es) returned by this importer.Methods:
setup()Performs any necessary setup before importing the first sample in the dataset.
Returns the dataset info for the dataset.
close(*args)Performs any necessary actions after the last sample has been imported.
- property has_dataset_info#
Whether this importer produces a dataset info dictionary.
- property has_image_metadata#
Whether this importer produces
fiftyone.core.metadata.ImageMetadatainstances for each image.
- property label_cls#
The
fiftyone.core.labels.Labelclass(es) returned by this importer.This can be any of the following:
a
fiftyone.core.labels.Labelclass. In this case, the importer is guaranteed to return labels of this typea list or tuple of
fiftyone.core.labels.Labelclasses. In this case, the importer can produce a single label field of any of these typesa dict mapping keys to
fiftyone.core.labels.Labelclasses. In this case, the importer will return label dictionaries with keys and value-types specified by this dictionary. Not all keys need be present in the imported labelsNone. In this case, the importer makes no guarantees about the labels that it may return
- setup()#
Performs any necessary setup before importing the first sample in the dataset.
This method is called when the importer’s context manager interface is entered,
DatasetImporter.__enter__().
- get_dataset_info()#
Returns the dataset info for the dataset.
By convention, this method should be called after all samples in the dataset have been imported.
- Returns:
a dict of dataset info
- close(*args)#
Performs any necessary actions after the last sample has been imported.
This method is called when the importer’s context manager interface is exited,
DatasetImporter.__exit__().- Parameters:
*args – the arguments to
DatasetImporter.__exit__()
- class fiftyone.utils.openlabel.OpenLABELVideoDatasetImporter(dataset_dir=None, data_path=None, labels_path=None, label_types=None, use_polylines=False, shuffle=False, seed=None, max_samples=None, skeleton=None, skeleton_key=None)#
Bases:
LabeledVideoDatasetImporter,ImportPathsMixinImporter for OpenLABEL video datasets stored on disk.
See this page for format details.
- Parameters:
dataset_dir (None) – the dataset directory. If omitted,
data_pathand/orlabels_pathmust be provideddata_path (None) –
an optional parameter that enables explicit control over the location of the media. Can be any of the following:
a folder name like
"data"or"data/"specifying a subfolder ofdataset_dirwhere the media files residean absolute directory path where the media files reside. In this case, the
dataset_dirhas no effect on the location of the dataa filename like
"data.json"specifying the filename of the JSON data manifest file indataset_diran absolute filepath specifying the location of the JSON data manifest. In this case,
dataset_dirhas no effect on the location of the dataa dict mapping file_ids to absolute filepaths
If None, this parameter will default to whichever of
data/ordata.jsonexists in the dataset directorylabels_path (None) –
an optional parameter that enables explicit control over the location of the labels. Can be any of the following:
a filename like
"labels.json"specifying the location of the labels indataset_dira folder name like
"labels"or"labels/"specifying a subfolder ofdataset_dirwhere the multiple label files residean absolute filepath to the labels. In this case,
dataset_dirhas no effect on the location of the labels
If None, the parameter will default to looking for
labels.jsonandlabels/label_types (None) – a label type or list of label types to load. The supported values are
("detections", "segmentations", "keypoints"). By default, all labels are loadeduse_polylines (False) – whether to represent segmentations as
fiftyone.core.labels.Polylinesinstances rather thanfiftyone.core.labels.Detectionswith dense masksshuffle (False) – whether to randomly shuffle the order in which the samples are imported
seed (None) – a random seed to use when shuffling
max_samples (None) – a maximum number of samples to load
skeleton (None) – a
fiftyone.core.odm.dataset.KeypointSkeletonto reference when loading keypointsskeleton_key (None) – the key in the OpenLABEL annotations pointing to the label of each keypoint matching the labels defined in the given
skeleton
Attributes:
Whether this importer produces a dataset info dictionary.
Whether this importer produces
fiftyone.core.metadata.VideoMetadatainstances for each video.The
fiftyone.core.labels.Labelclass(es) returned by this importer within the sample-level labels that it produces.The
fiftyone.core.labels.Labelclass(es) returned by this importer within the frame labels that it produces.Methods:
setup()Performs any necessary setup before importing the first sample in the dataset.
Returns the dataset info for the dataset.
close(*args)Performs any necessary actions after the last sample has been imported.
- property has_dataset_info#
Whether this importer produces a dataset info dictionary.
- property has_video_metadata#
Whether this importer produces
fiftyone.core.metadata.VideoMetadatainstances for each video.
- property label_cls#
The
fiftyone.core.labels.Labelclass(es) returned by this importer within the sample-level labels that it produces.This can be any of the following:
a
fiftyone.core.labels.Labelclass. In this case, the importer is guaranteed to return sample-level labels of this typea list or tuple of
fiftyone.core.labels.Labelclasses. In this case, the importer can produce a single sample-level label field of any of these typesa dict mapping keys to
fiftyone.core.labels.Labelclasses. In this case, the importer will return sample-level label dictionaries with keys and value-types specified by this dictionary. Not all keys need be present in the imported labelsNone. In this case, the importer makes no guarantees about the sample-level labels that it may return
- setup()#
Performs any necessary setup before importing the first sample in the dataset.
This method is called when the importer’s context manager interface is entered,
DatasetImporter.__enter__().
- get_dataset_info()#
Returns the dataset info for the dataset.
By convention, this method should be called after all samples in the dataset have been imported.
- Returns:
a dict of dataset info
- close(*args)#
Performs any necessary actions after the last sample has been imported.
This method is called when the importer’s context manager interface is exited,
DatasetImporter.__exit__().- Parameters:
*args – the arguments to
DatasetImporter.__exit__()
- property frame_labels_cls#
The
fiftyone.core.labels.Labelclass(es) returned by this importer within the frame labels that it produces.This can be any of the following:
a
fiftyone.core.labels.Labelclass. In this case, the importer is guaranteed to return frame labels of this typea list or tuple of
fiftyone.core.labels.Labelclasses. In this case, the importer can produce a single frame label field of any of these typesa dict mapping keys to
fiftyone.core.labels.Labelclasses. In this case, the importer will return frame label dictionaries with keys and value-types specified by this dictionary. Not all keys need be present in each frameNone. In this case, the importer makes no guarantees about the frame labels that it may return
- class fiftyone.utils.openlabel.OpenLABELAnnotations#
Bases:
objectAnnotations parsed from OpenLABEL format able to be converted to FiftyOne labels.
Methods:
parse_labels(base_dir, labels_path)Parses a single OpenLABEL labels file.
get_dimensions(file_id)Get the width and height of a given URI or file id
get_labels(uri, label_types, frame_size, ...)Get the FiftyOne labels corresponding to the annotations of a given URI.
- parse_labels(base_dir, labels_path)#
Parses a single OpenLABEL labels file.
- Parameters:
base_dir – path to the directory containing the labels file
labels_path – path to the labels json file
- Returns:
a list of potential file_ids that the parsed labels correspond to
- get_dimensions(file_id)#
Get the width and height of a given URI or file id
- Parameters:
file_id – the unique identifier to a media file
- Returns:
(width, height) of the given file
- get_labels(uri, label_types, frame_size, seg_type, skeleton=None, skeleton_key=None)#
Get the FiftyOne labels corresponding to the annotations of a given URI. The results are two dictionaries, sample- and frame-level, mapping field names to values and label objects.
- Parameters:
uri – the unique identifier to a media file
label_types – a list of label types to load. The supported values are
("detections", "segmentations", "keypoints").frame_size – the (width, height) tuple for the media frame
seg_type – the
SegmentationTypeto use for segmentation annotationsskeleton (None) – a
fiftyone.core.odm.dataset.KeypointSkeletonto use as a reference when loading keypointsskeleton_key (None) – the name of the field in the OpenLABEL annotations containing the labels of keypoints matching the labels of the given skeleton
- Returns:
a dictionary of sample level fields and label objects and a dictionary of frame numbers to frame level fields and label objects
- class fiftyone.utils.openlabel.OpenLABELStreamInfos(infos=None)#
Bases:
objectA collection of multiple
OpenLABELStreamInfoobjects.Methods:
get_stream_attributes([frame_number])Aggregates attributes from all streams in this collection.
Attributes:
All frame numbers existing in the
OpenLABELStreamInfoobjects in this collection.- get_stream_attributes(frame_number=None)#
Aggregates attributes from all streams in this collection.
- Parameters:
frame_number (None) – a specific frame number for which to get stream attributes
- Returns:
a dictionary of attributes from all streams in this collection
- property frame_numbers#
All frame numbers existing in the
OpenLABELStreamInfoobjects in this collection.
- class fiftyone.utils.openlabel.OpenLABELStreamInfo(frame_numbers=None, stream=None, label_file_id=None, is_sample_level=None)#
Bases:
objectInformation about a stream used to gather specific objects for a media file.
- Parameters:
frame_numbers (None) – frame numbers related to this stream info
stream (None) – an
OpenLABELStreamlabel_file_id (None) – a label file id related to this stream info
is_sample_level (None) – whether this stream info corresponds to sample-level or frame-level
Attributes:
Whether there exists a stream corresponding to this info.
Methods:
Get a dictionary of attributes for the stream in this object.
- property is_streamless#
Whether there exists a stream corresponding to this info.
- get_stream_attributes()#
Get a dictionary of attributes for the stream in this object.
- Returns:
a dictionary of attributes from the corresponding stream
- class fiftyone.utils.openlabel.OpenLABELGroup#
Bases:
objectA utility for parsing groups of OpenLABEL elements
- class fiftyone.utils.openlabel.OpenLABELObjects#
Bases:
OpenLABELGroupA collection of
OpenLABELObjectand corresponding utility methods.Attributes:
Get streams corresponding to any object in this collection.
A list of
OpenLABELObjectinstances in this collection.Methods:
parse_objects_dict(objects_dict, label_file_id)Parses the OpenLABEL annotations corresponding to a specific dictionary of objects.
add_object(obj_key, label_file_id, obj)Adds an
OpenLABELObjectto this collection.get_objects(stream_infos)Gets any objects that correspond to an info in the given stream infos.
to_labels(frame_size, label_types, seg_type, ...)Converts the stored
OpenLABELObjectto FiftyOne labels.- property streams#
Get streams corresponding to any object in this collection.
- property all_objects#
A list of
OpenLABELObjectinstances in this collection.
- parse_objects_dict(objects_dict, label_file_id, frame_number=None)#
Parses the OpenLABEL annotations corresponding to a specific dictionary of objects.
- Parameters:
objects_dict – the dict of OpenLABEL object annotations
label_file_id – the name of the annotations file containing these objects
frame_number (None) – an optional frame that this
objects_dictis in
- add_object(obj_key, label_file_id, obj)#
Adds an
OpenLABELObjectto this collection.- Parameters:
obj_key – the name of the object in the OpenLABEL annotations
label_file_id – the filename of the annotations file containing this label
obj – the
OpenLABELObjectto add
- get_objects(stream_infos)#
Gets any objects that correspond to an info in the given stream infos.
- Parameters:
stream_infos – a
OpenLABELStreamInfosused to get corresponding objects- Returns:
an
OpenLABELObjectswith objects that correspond to any of the given stream infos
- to_labels(frame_size, label_types, seg_type, stream_infos, skeleton=None, skeleton_key=None)#
Converts the stored
OpenLABELObjectto FiftyOne labels.- Parameters:
frame_size – the size of the image frame in pixels (width, height)
label_types – a list of label types to load
seg_type – the
SegmentationTypeto use to store segmentationsstream_infos – the
OpenLABELStreamInfoscontaining sample-level attributes to parse into labelsskeleton (None) – a
fiftyone.core.odm.dataset.KeypointSkeletonto use when loading keypoint annotationsskeleton_key (None) – the name of the field in the OpenLABEL annotations containing the labels of keypoints matching the labels of the given skeleton
- Returns:
a dictionary of sample level fields and label objects and a dictionary of frame numbers to frame level fields and label objects
- class fiftyone.utils.openlabel.OpenLABELStreams#
Bases:
OpenLABELGroupA collection of OpenLABEL streams.
Attributes:
All unique media file identifiers corresponding to streams in this collection.
Methods:
parse_streams_dict(streams_dict, label_file_id)Parses the OpenLABEL annotations corresponding to a specific dictionary of streams.
get_dimensions(uri)Get the width and height of a given URI or file id.
get_stream_info(uri)Get all stream infos, including stream and relevant frame numbers, for a given media file identifier.
- property uris#
All unique media file identifiers corresponding to streams in this collection.
- parse_streams_dict(streams_dict, label_file_id, frame_number=None)#
Parses the OpenLABEL annotations corresponding to a specific dictionary of streams.
- Parameters:
streams_dict – the dict of OpenLABEL stream annotations
label_file_id – the name of the annotations file containing these streams
frame_number (None) – an optional frame that this
streams_dictis in
- get_dimensions(uri)#
Get the width and height of a given URI or file id.
- Parameters:
file_id – the unique identifier to a media file
- Returns:
the
(width, height)of the given file
- get_stream_info(uri)#
Get all stream infos, including stream and relevant frame numbers, for a given media file identifier.
- Parameters:
uri – the unique media file identifier for which to get all stream infos
- Returns:
the
OpenLABELStreamInfoscorresponding to the given uri
- class fiftyone.utils.openlabel.AttributeParser#
Bases:
objectMethods used to parse attributes from OpenLABEL annotations.
- class fiftyone.utils.openlabel.OpenLABELShape(coords, attributes=None, stream=None)#
Bases:
AttributeParserA single OpenLABEL shape like a bounding box or polygon.
Methods:
Constructs a shape from a dictionary of information.
- classmethod from_shape_dict(d)#
Constructs a shape from a dictionary of information.
- Parameters:
d – a dictionary containing information about a shape
- Returns:
- class fiftyone.utils.openlabel.OpenLABELBBox(coords, attributes=None, stream=None)#
Bases:
OpenLABELShapeAn OpenLABEL bounding box.
Methods:
to_label(label, attributes, width, height)Convert this shape to a FiftyOne label.
Constructs a shape from a dictionary of information.
- to_label(label, attributes, width, height)#
Convert this shape to a FiftyOne label.
- Parameters:
label – the class label for this shape
attributes – a dictionary of attributes for this shape
width – the width of the frame in pixels
height – the height of the frame in pixels
- Returns:
- classmethod from_shape_dict(d)#
Constructs a shape from a dictionary of information.
- Parameters:
d – a dictionary containing information about a shape
- Returns:
- class fiftyone.utils.openlabel.OpenLABELPoly2D(coords, attributes=None, stream=None)#
Bases:
OpenLABELShapeAn OpenLABEL polyline.
Methods:
to_label(label, attributes, width, height)Convert this shape to a FiftyOne label.
Constructs a shape from a dictionary of information.
- to_label(label, attributes, width, height)#
Convert this shape to a FiftyOne label.
- Parameters:
label – the class label for this shape
attributes – a dictionary of attributes for this shape
width – the width of the frame in pixels
height – the height of the frame in pixels
- Returns:
- classmethod from_shape_dict(d)#
Constructs a shape from a dictionary of information.
- Parameters:
d – a dictionary containing information about a shape
- Returns:
- class fiftyone.utils.openlabel.OpenLABELPoint(coords, attributes=None, stream=None)#
Bases:
OpenLABELShapeAn OpenLABEL keypoint.
Methods:
to_label(label, attributes, width, height[, ...])Convert this shape to a FiftyOne label.
Constructs a shape from a dictionary of information.
- to_label(label, attributes, width, height, skeleton=None, skeleton_key=None)#
Convert this shape to a FiftyOne label.
- Parameters:
label – the class label for this shape
attributes – a dictionary of attributes for this shape
width – the width of the frame in pixels
height – the height of the frame in pixels
skeleton (None) – a
fiftyone.core.odm.dataset.KeypointSkeletonused to sort list attributes based on the labels in the skeleton. Used only ifskeleton_keyis providedskeleton_key (None) – the string key into the attributes dictionary containing the label of each point, used to sort list attribute fields based on the labels in the skeleton. Used only if
skeletonis provided
- Returns:
- classmethod from_shape_dict(d)#
Constructs a shape from a dictionary of information.
- Parameters:
d – a dictionary containing information about a shape
- Returns:
- class fiftyone.utils.openlabel.OpenLABELShapes(shapes=None, attributes=None, stream=None)#
Bases:
AttributeParserA collection of OpenLABEL shapes.
Attributes:
A list of streams corresponding to any object in this collection.
Methods:
from_object_data_list(shape_type, l[, ...])Construct an
OpenLABELShapesfrom a list of shape dictionaries.merge_shapes(shapes)Merges another
OpenLABELShapesinto this one.to_labels(label, attributes, width, height)Convert this shape to a FiftyOne label.
- property streams#
A list of streams corresponding to any object in this collection.
- classmethod from_object_data_list(shape_type, l, attributes=None)#
Construct an
OpenLABELShapesfrom a list of shape dictionaries.- Parameters:
shape_type – the type of the shape being loaded. Options are (
OpenLABELBBox,OpenLABELPoly2D,OpenLABELPoint)l – a list of shape dictionaries parsed from OpenLABEL object annotations
attributes (None) – a dictionary of attributes corresponding to all shapes in this collection
- Returns:
- merge_shapes(shapes)#
Merges another
OpenLABELShapesinto this one.- Parameters:
shapes – another
OpenLABELShapesto merge into this object
- to_labels(label, attributes, width, height, is_points=False, skeleton=None, skeleton_key=None)#
Convert this shape to a FiftyOne label.
- Parameters:
label – the class label for this shape
attributes – a dictionary of attributes for this shape
width – the width of the frame in pixels
height – the height of the frame in pixels
is_points (False) – whether the labels being converted are keypoints
skeleton (None) – a
fiftyone.core.odm.dataset.KeypointSkeletonused to sort list attributes based on the labels in the skeleton. Used only ifis_pointsandskeleton_keyis providedskeleton_key (None) – the string key into the attributes dictionary containing the label of each point, used to sort list attribute fields based on the labels in the skeleton. Used only if
is_pointsandskeletonis provided
- Returns:
- class fiftyone.utils.openlabel.OpenLABELStream(name, type=None, properties=None, uris=None, other_attrs=None)#
Bases:
objectAn OpenLABEL stream corresponding to one uri or file_id.
- Parameters:
name (None) – the name of the stream
type (None) – the type of the stream
description (None) – a string description for this stream
properties (None) – a dict of properties for this stream
uri (None) – the uri or file_id of the media corresponding to this stream
other_attrs (None) – a dictionary of other attributes corresponding to this stream
Methods:
update_dict(d[, frame_number])Updates this stream with additional information.
get_frame_numbers(uri)Get frame numbers corresponding to the given uri.
from_anno_dict(stream_name, d, frame_number)Create an OpenLABEL stream from the stream information dictionary.
Attributes:
Get uris corresponding to any stream in this collection.
- update_dict(d, frame_number=None)#
Updates this stream with additional information.
- Parameters:
d – a dict containing additional stream information
frame_number (None) – the frame number from which this stream information dict was parsed, ‘None’ if from the top-level streams
- property uris#
Get uris corresponding to any stream in this collection.
- get_frame_numbers(uri)#
Get frame numbers corresponding to the given uri.
- classmethod from_anno_dict(stream_name, d, frame_number)#
Create an OpenLABEL stream from the stream information dictionary.
- Parameters:
stream_name – the name of the stream
d – a dict containing information about this stream
frame_number – the frame number from which this stream information dict was parsed, ‘None’ if from the top-level streams
- Returns:
- class fiftyone.utils.openlabel.OpenLABELMetadata(metadata_dict)#
Bases:
objectA parser and storage for OpenLABEL metadata.
Methods:
Parses metadata for any fields that may correspond to a label-wide media file_id.
- parse_potential_file_ids()#
Parses metadata for any fields that may correspond to a label-wide media file_id.
- Returns:
a list of potential file_id strings
- class fiftyone.utils.openlabel.OpenLABELObject(key, name=None, type=None, bboxes=None, segmentations=None, keypoints=None, stream=None, other_attrs=None, is_frame_level=False)#
Bases:
AttributeParserAn object parsed from OpenLABEL labels.
- Parameters:
key – the OpenLABEL key string for this object
name (None) – the name string of the object
type (None) – the type string of the object
bboxes (None) – an :class`OpenLABELShapes` of bounding boxes for this object
segmentations (None) – an :class`OpenLABELShapes` of polygon segmentations for this object
keyponts (None) – an
OpenLABELShapesof keypoints for this objectstream (None) – the
OpenLABELStreamthis object corresponds toother_attrs (None) – a dict of attributes and their values for this object
is_frame_level (False) – whether this object is sample-level or frame-level
Attributes:
Get streams corresponding to this object.
Whether any streams are connected to this object or corresponding frame-level objects.
Methods:
filter_stream(stream_info)Filters this object to contain only frame labels specified in the given stream info
to_detections(frame_size)Converts the bounding boxes in this object to
fiftyone.core.labels.Detectionobjects.to_polylines(frame_size)Converts the segmentations in this object to
fiftyone.core.labels.Polylineobjects.to_keypoints(frame_size[, skeleton, ...])Converts the keypoints in this object to
fiftyone.core.labels.Keypointobjects.from_anno_dict(obj_key, d[, frame_number])Create an
OpenLABELObjectfrom the raw label dictionary.update_dict(d[, frame_number])Updates this
OpenLABELObjectgiven the raw label dictionary.- property streams#
Get streams corresponding to this object.
- property is_streamless#
Whether any streams are connected to this object or corresponding frame-level objects.
- filter_stream(stream_info)#
Filters this object to contain only frame labels specified in the given stream info
- Parameters:
stream_info – the
OpenLABELStreamInfoto use to filter this object- Returns:
an
OpenLABELObjectcontaining only frames related to the given stream info
- to_detections(frame_size)#
Converts the bounding boxes in this object to
fiftyone.core.labels.Detectionobjects.- Parameters:
frame_size – the size of the frame in pixels (width, height)
- Returns:
a list of
fiftyone.core.labels.Detectionobjects for each bounding box in this object
- to_polylines(frame_size)#
Converts the segmentations in this object to
fiftyone.core.labels.Polylineobjects.- Parameters:
frame_size – the size of the frame in pixels (width, height)
- Returns:
a list of
fiftyone.core.labels.Polylineobjects for each polyline in this object
- to_keypoints(frame_size, skeleton=None, skeleton_key=None)#
Converts the keypoints in this object to
fiftyone.core.labels.Keypointobjects.- Parameters:
frame_size – the size of the frame in pixels (width, height)
- Returns:
a list of
fiftyone.core.labels.Keypointobjects for each keypoint in this object
- classmethod from_anno_dict(obj_key, d, frame_number=None)#
Create an
OpenLABELObjectfrom the raw label dictionary.- Parameters:
anno_id – id of the object
d – dict containing the information for this object
- Returns:
a tuple containing the
OpenLABELObjectand the frame numbers the object corresponds to, if any.
- update_dict(d, frame_number=None)#
Updates this
OpenLABELObjectgiven the raw label dictionary.- Parameters:
d – dict containing the information for this object
- Returns:
newly parsed frame numbers the object corresponds to, if any