class COCODetectionDatasetExporter(foud.LabeledImageDatasetExporter, foud.ExportPathsMixin): (source)
Constructor: COCODetectionDatasetExporter(export_dir, data_path, labels_path, export_media, ...)
Exporter that writes COCO detection datasets to disk.
See :ref:`this page <COCODetectionDataset-export>` for format details.
Parameters | |
export | the directory to write the export. This has no effect if data_path and labels_path are absolute paths |
data | an optional parameter that enables explicit control over the location of the exported media. Can be any of the following:
If None, the default value of this parameter will be chosen based on the value of the export_media parameter |
labels | an optional parameter that enables explicit control over the location of the exported labels. Can be any of the following:
If None, the labels will be exported into export_dir using the default filename |
export | controls how to export the raw media. The supported values are:
If None, the default value of this parameter will be chosen based on the value of the data_path parameter |
rel | an optional relative directory to strip from each input
filepath to generate a unique identifier for each image. When
exporting media, this identifier is joined with data_path to
generate an output path for each exported image. This argument
allows for populating nested subdirectories that match the shape of
the input paths. The path is converted to an absolute path (if
necessary) via fiftyone.core.storage.normalize_path |
abs | whether to store absolute paths to the images in the exported labels |
image | the image format to use when writing in-memory images to disk. By default, fiftyone.config.default_image_ext is used |
classes | the list of possible class labels |
categories | a list of category dicts in the format of
parse_coco_categories specifying the classes and their
category IDs |
info | a dict of info as returned by
load_coco_detection_annotations to include in the exported
JSON. If not provided, this info will be extracted when
log_collection is called, if possible |
extra | whether to include extra object attributes in the exported labels. Supported values are:
|
coco | the name of a sample field containing the COCO IDs of each image |
annotation | the name of a label field containing the COCO annotation ID of each label |
iscrowd | the name of a detection attribute that indicates whether an object is a crowd (the value is automatically set to 0 if the attribute is not present) |
num | an optional number of decimal places at which to round bounding box pixel coordinates. By default, no rounding is done |
tolerance | a tolerance, in pixels, when generating approximate polylines for instance masks. Typical values are 1-3 pixels |
Method | __init__ |
Undocumented |
Method | close |
Performs any necessary actions after the last sample has been exported. |
Method | export |
Exports the given sample to the dataset. |
Method | log |
Logs any relevant information about the fiftyone.core.collections.SampleCollection whose samples will be exported. |
Method | setup |
Performs any necessary setup before exporting the first sample in the dataset. |
Instance Variable | abs |
Undocumented |
Instance Variable | annotation |
Undocumented |
Instance Variable | categories |
Undocumented |
Instance Variable | classes |
Undocumented |
Instance Variable | coco |
Undocumented |
Instance Variable | data |
Undocumented |
Instance Variable | export |
Undocumented |
Instance Variable | extra |
Undocumented |
Instance Variable | image |
Undocumented |
Instance Variable | info |
Undocumented |
Instance Variable | iscrowd |
Undocumented |
Instance Variable | labels |
Undocumented |
Instance Variable | num |
Undocumented |
Instance Variable | rel |
Undocumented |
Instance Variable | tolerance |
Undocumented |
Property | label |
The fiftyone.core.labels.Label class(es) exported by this exporter. |
Property | requires |
Whether this exporter requires fiftyone.core.metadata.ImageMetadata instances for each sample being exported. |
Method | _parse |
Undocumented |
Instance Variable | _anno |
Undocumented |
Instance Variable | _annotations |
Undocumented |
Instance Variable | _classes |
Undocumented |
Instance Variable | _dynamic |
Undocumented |
Instance Variable | _has |
Undocumented |
Instance Variable | _image |
Undocumented |
Instance Variable | _image |
Undocumented |
Instance Variable | _images |
Undocumented |
Instance Variable | _labels |
Undocumented |
Instance Variable | _media |
Undocumented |
Inherited from DatasetExporter
(via LabeledImageDatasetExporter
):
Method | __enter__ |
Undocumented |
Method | __exit__ |
Undocumented |
Inherited from ExportPathsMixin
(via LabeledImageDatasetExporter
, DatasetExporter
):
Static Method | _parse |
Helper function that computes default values for the data_path and export_media parameters supported by many exporters. |
Static Method | _parse |
Helper function that computes default values for the labels_path parameter supported by many exporters. |
Undocumented
Performs any necessary actions after the last sample has been exported.
This method is called when the exporter's context manager interface is
exited, DatasetExporter.__exit__
.
Parameters | |
*args | the arguments to DatasetExporter.__exit__ |
Exports the given sample to the dataset.
Parameters | |
image | an image or the path to the image on disk |
label | an instance of label_cls , or a dictionary mapping
field names to fiftyone.core.labels.Label instances,
or None if the sample is unlabeled |
metadata:None | a fiftyone.core.metadata.ImageMetadata
instance for the sample. Only required when
requires_image_metadata is True |
Logs any relevant information about the
fiftyone.core.collections.SampleCollection
whose samples will
be exported.
Subclasses can optionally implement this method if their export format
can record information such as the
fiftyone.core.collections.SampleCollection.info
of the
collection being exported.
By convention, this method must be optional; i.e., if it is not called
before the first call to export_sample
, then the exporter must
make do without any information about the
fiftyone.core.collections.SampleCollection
(which may not be
available, for example, if the samples being exported are not stored in
a collection).
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection whose
samples will be exported |
Performs any necessary setup before exporting the first sample in the dataset.
This method is called when the exporter's context manager interface is
entered, DatasetExporter.__enter__
.
The fiftyone.core.labels.Label
class(es) exported by this
exporter.
This can be any of the following:
- a
fiftyone.core.labels.Label
class. In this case, the exporter directly exports labels of this type - a list or tuple of
fiftyone.core.labels.Label
classes. In this case, the exporter can export a single label field of any of these types - a dict mapping keys to
fiftyone.core.labels.Label
classes. In this case, the exporter can handle label dictionaries with value-types specified by this dictionary. Not all keys need be present in the exported label dicts - None. In this case, the exporter makes no guarantees about the labels that it can export
Whether this exporter requires
fiftyone.core.metadata.ImageMetadata
instances for each sample
being exported.