class ImageDetectionSampleParser(LabeledImageTupleSampleParser): (source)
Known subclasses: fiftyone.utils.data.parsers.FiftyOneImageDetectionSampleParser
, fiftyone.zoo.datasets.tf._TFDSImageDetectionSampleParser
, fiftyone.zoo.datasets.torch._VOCDetectionSampleParser
Constructor: ImageDetectionSampleParser(label_field, bounding_box_field, confidence_field, attributes_field, ...)
Generic parser for image detection samples whose labels are represented
as fiftyone.core.labels.Detections
instances.
This implementation supports samples that are (image_or_path, detections_or_path) tuples, where:
image_or_path is either an image that can be converted to numpy format via np.asarray() or the path to an image on disk
detections_or_path can be any of the following:
None, for unlabeled images
a list of detections in the following format:
[ { "<label_field>": <label-or-target>, "<bounding_box_field>": [ <top-left-x>, <top-left-y>, <width>, <height> ], "<confidence_field>": <optional-confidence>, "<attributes_field>": { <optional-name>: <optional-value>, ... } }, ... ]In the above, label-or-target is either a class ID (if classes is provided) or a label string, and the bounding box coordinates can either be relative coordinates in [0, 1] (if normalized == True) or absolute pixels coordinates (if normalized == False). The confidence and attributes fields are optional for each sample.
The input field names can be configured as necessary when instantiating the parser.
the path on disk to a file in the above format
a
fiftyone.core.labels.Detections
instance
Parameters | |
label | the name of the object label field in the target dicts |
bounding | the name of the bounding box field in the target dicts |
confidence | the name of the optional confidence field in the target dicts |
attributes | the name of the optional attributes field in the target dicts |
classes | an optional list of class label strings. If provided, it is assumed that the target values are class IDs that should be mapped to label strings via classes[target] |
normalized | whether the bounding box coordinates are absolute pixel coordinates (False) or relative coordinates in [0, 1] (True) |
Method | __init__ |
Undocumented |
Method | get |
Returns the label for the current sample. |
Instance Variable | attributes |
Undocumented |
Instance Variable | bounding |
Undocumented |
Instance Variable | classes |
Undocumented |
Instance Variable | confidence |
Undocumented |
Instance Variable | label |
Undocumented |
Instance Variable | normalized |
Undocumented |
Property | label |
The fiftyone.core.labels.Label class(es) returned by this parser. |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Inherited from LabeledImageTupleSampleParser
:
Method | clear |
Clears the current sample. |
Method | get |
Returns the image from the current sample. |
Method | get |
Returns the image path for the current sample. |
Property | has |
Whether this parser produces fiftyone.core.metadata.ImageMetadata instances for samples that it parses. |
Property | has |
Whether this parser produces paths to images on disk for samples that it parses. |
Method | _get |
Undocumented |
Method | _parse |
Undocumented |
Instance Variable | _current |
Undocumented |
Property | _current |
Undocumented |
Inherited from LabeledImageSampleParser
(via LabeledImageTupleSampleParser
):
Method | get |
Returns the image metadata for the current sample. |
Inherited from SampleParser
(via LabeledImageTupleSampleParser
, LabeledImageSampleParser
):
Method | with |
Sets the current sample so that subsequent calls to methods of this parser will return information from the given sample. |
Property | current |
The current sample. |
Instance Variable | _current |
Undocumented |
fiftyone.zoo.datasets.tf._TFDSImageDetectionSampleParser
Returns the label for the current sample.
Returns | |
a fiftyone.core.labels.Detections instance |
The fiftyone.core.labels.Label
class(es) returned by this
parser.
This can be any of the following:
- a
fiftyone.core.labels.Label
class. In this case, the parser is guaranteed to return labels of this type - a list or tuple of
fiftyone.core.labels.Label
classes. In this case, the parser can produce a single label field of any of these types - a dict mapping keys to
fiftyone.core.labels.Label
classes. In this case, the parser will return label dictionaries with keys and value-types specified by this dictionary. Not all keys need be present in the imported labels - None. In this case, the parser makes no guarantees about the labels that it may return
fiftyone.zoo.datasets.tf._TFDSImageDetectionSampleParser
, fiftyone.zoo.datasets.torch._VOCDetectionSampleParser
Undocumented