class LabeledImageTupleSampleParser(LabeledImageSampleParser): (source)
Known subclasses: fiftyone.utils.data.parsers.ImageClassificationSampleParser
, fiftyone.utils.data.parsers.ImageDetectionSampleParser
, fiftyone.utils.data.parsers.ImageLabelsSampleParser
Generic sample parser that parses samples that are (image_or_path, label) 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
- label is a
fiftyone.core.labels.Label
instance
This implementation provides a _current_image
property that
caches the image for the current sample, for efficiency in case multiple
getters require access to the image (e.g., to normalize coordinates,
compute metadata, etc).
See the following subclasses of this parser for implementations that parse labels for common tasks:
- Image classification:
ImageClassificationSampleParser
- Object detection:
ImageDetectionSampleParser
- Multitask image prediction:
ImageLabelsSampleParser
Method | __init__ |
Undocumented |
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. |
Method | get |
Returns the label 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. |
Property | label |
The fiftyone.core.labels.Label class(es) returned by this parser. |
Method | _get |
Undocumented |
Method | _parse |
Undocumented |
Instance Variable | _current |
Undocumented |
Property | _current |
Undocumented |
Inherited from LabeledImageSampleParser
:
Method | get |
Returns the image metadata for the current sample. |
Inherited from SampleParser
(via 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.utils.data.parsers.ImageClassificationSampleParser
, fiftyone.utils.data.parsers.ImageDetectionSampleParser
, fiftyone.utils.data.parsers.ImageLabelsSampleParser
Returns the label for the current sample.
Returns | |
a fiftyone.core.labels.Label instance, or a dictionary
mapping field names to fiftyone.core.labels.Label
instances, or None if the sample is unlabeled |
Whether this parser produces
fiftyone.core.metadata.ImageMetadata
instances for samples
that it parses.
fiftyone.utils.data.parsers.ImageClassificationSampleParser
, fiftyone.utils.data.parsers.ImageDetectionSampleParser
, fiftyone.utils.data.parsers.ImageLabelsSampleParser
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