class LabeledImageSampleParser(SampleParser): (source)
Known subclasses: fiftyone.utils.data.parsers.FiftyOneLabeledImageSampleParser
, fiftyone.utils.data.parsers.LabeledImageTupleSampleParser
, fiftyone.utils.dicom.DICOMSampleParser
, fiftyone.utils.tf.TFRecordSampleParser
Interface for SampleParser
instances that parse labeled image
samples.
Instances of this class must return images in numpy format and labels
as fiftyone.core.labels.Label
instances.
The general recipe for using LabeledImageSampleParser
instances
is as follows:
sample_parser = LabeledImageSampleParser(...) for sample in samples: sample_parser.with_sample(sample) img = sample_parser.get_image() label = sample_parser.get_label() if sample_parser.has_image_path: image_path = sample_parser.get_image_path() if sample_parser.has_image_metadata: image_metadata = sample_parser.get_image_metadata()
Method | get |
Returns the image from the current sample. |
Method | get |
Returns the image metadata for 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. |
Inherited from SampleParser
:
Method | __init__ |
Undocumented |
Method | clear |
Clears the current sample. |
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.FiftyOneLabeledImageSampleParser
, fiftyone.utils.data.parsers.LabeledImageTupleSampleParser
, fiftyone.utils.dicom.DICOMSampleParser
, fiftyone.utils.tf.TFRecordSampleParser
Returns the image from the current sample.
Returns | |
a numpy image |
fiftyone.utils.data.parsers.FiftyOneLabeledImageSampleParser
, fiftyone.utils.tf.TFImageClassificationSampleParser
, fiftyone.utils.tf.TFObjectDetectionSampleParser
Returns the image metadata for the current sample.
Returns | |
a fiftyone.core.metadata.ImageMetadata instance |
fiftyone.utils.data.parsers.FiftyOneLabeledImageSampleParser
, fiftyone.utils.data.parsers.LabeledImageTupleSampleParser
Returns the image path for the current sample.
Returns | |
the path to the image on disk |
fiftyone.utils.data.parsers.FiftyOneLabeledImageSampleParser
, fiftyone.utils.data.parsers.LabeledImageTupleSampleParser
, fiftyone.utils.dicom.DICOMSampleParser
, fiftyone.utils.tf.TFRecordSampleParser
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 |
fiftyone.utils.data.parsers.FiftyOneLabeledImageSampleParser
, fiftyone.utils.data.parsers.LabeledImageTupleSampleParser
, fiftyone.utils.dicom.DICOMSampleParser
, fiftyone.utils.tf.TFImageClassificationSampleParser
, fiftyone.utils.tf.TFObjectDetectionSampleParser
Whether this parser produces
fiftyone.core.metadata.ImageMetadata
instances for samples
that it parses.
fiftyone.utils.data.parsers.FiftyOneLabeledImageSampleParser
, fiftyone.utils.data.parsers.LabeledImageTupleSampleParser
, fiftyone.utils.dicom.DICOMSampleParser
, fiftyone.utils.tf.TFImageClassificationSampleParser
, fiftyone.utils.tf.TFObjectDetectionSampleParser
Whether this parser produces paths to images on disk for samples that it parses.
fiftyone.utils.data.parsers.FiftyOneLabeledImageSampleParser
, fiftyone.utils.data.parsers.LabeledImageTupleSampleParser
, fiftyone.utils.dicom.DICOMSampleParser
, fiftyone.utils.tf.TFImageClassificationSampleParser
, fiftyone.utils.tf.TFObjectDetectionSampleParser
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