COCOData#

class COCOData[source]#

Class for loading the COCO dataset, inherits from DetectionData.

Implement the necessary methods to load the dataset.

__init__(data_loader: DataLoader, num_classes: Optional[int] = None, label_map: Optional[Dict[int, str]] = None, transform_field: Optional[str] = 'transforms', dataset_name: Optional[str] = None)[source]#
__new__(*args, **kwargs)#

Attributes

COCOData.classes_indices

Return dict of classes as keys, and list of corresponding indices (in Dataset) of samples that include this class (in the label).

COCOData.data_dimension

Return how many dimensions the image data have.

COCOData.data_loader

Return the data loader.

COCOData.has_images

Return True if the data loader has images.

COCOData.has_labels

Return True if the data loader has labels.

COCOData.n_of_samples_per_class

Return a dictionary containing the number of samples per class.

COCOData.num_classes

Return the number of classes in the dataset.

COCOData.num_samples

Return the number of samples in the dataset.

COCOData.original_num_samples

Return the number of samples in the original dataset.

COCOData.task_type

Return the task type (object_detection).

COCOData.transform_field

Return the data loader.

Methods

COCOData.assert_images_valid()

Assert the image formatter defined is valid.

COCOData.assert_labels_valid()

Assert the label formatter defined is valid.

COCOData.batch_of_index(*indices)

Return batch samples of the given batch indices.

COCOData.batch_to_images(batch)

Convert the batch to a list of images.

COCOData.batch_to_labels(batch)

Convert the batch to a list of labels.

COCOData.copy([n_samples, shuffle, random_state])

Create new copy of this object, with the data-loader and dataset also copied, and altered by the given parameters.

COCOData.from_dataset(data[, batch_size, ...])

Create VisionData instance from a Dataset instance.

COCOData.get_augmented_dataset(aug)

Return a copy of the vision data object with the augmentation in the start of it.

COCOData.get_classes(batch_labels)

Get a labels batch and return classes inside it.

COCOData.get_transform_type()

Return transforms handler created from the transform field.

COCOData.infer_on_batch(batch, model, device)

Infer on a batch of images.

COCOData.init_cache()

Initialize the cache of the classes' metadata info.

COCOData.is_sampled()

Return whether the vision data is running on sample of the data.

COCOData.label_id_to_name(class_id)

Return the name of the class with the given id.

COCOData.to_batch(*samples)

Use the defined collate_fn to transform a few data items to batch format.

COCOData.to_dataset_index(*batch_indices)

Return for the given batch_index the sample index in the dataset object.

COCOData.update_cache(batch)

Get labels and update the classes' metadata info.

COCOData.validate_format(model[, device])

Validate the correctness of the data class implementation according to the expected format.

COCOData.validate_get_classes(batch)

Validate that the get_classes function returns data in the correct format.

COCOData.validate_image_data(batch)

Validate that the data is in the required format.

COCOData.validate_inferred_batch_predictions(...)

Validate the inferred predictions from the batch.

COCOData.validate_label(batch)

Validate the label.

COCOData.validate_prediction(batch, model, ...)

Validate the prediction.

COCOData.validate_shared_label(other)

Verify presence of shared labels.