dataeval.utils.data.collate¶
-
dataeval.utils.data.collate(dataset: ImageClassificationDataset[TArray] | ObjectDetectionDataset[TArray], model: torch.nn.Module, device: torch.device | str | None =
None, batch_size: int =64) tuple[torch.Tensor, Targets, list[dict[str, Any]]]¶ -
dataeval.utils.data.collate(dataset: ImageClassificationDataset[TArray] | ObjectDetectionDataset[TArray], model: None =
None, device: torch.device | str | None =None, batch_size: int =64) tuple[list[TArray], Targets, list[dict[str, Any]]] Collates a dataset to images/embeddings, targets and metadata.
- Parameters:¶
- dataset : ImageClassificationDataset or ObjectDetectionDataset¶
A dataset conforming to MAITE dataset protocols.
- model : torch.nn.Module or None, default None¶
A torch model to use for encoding. If an encode() function is present on the model it will be called, otherwise it will use the __call__() function.
- device : torch.device, str or None, default None¶
Device to use when encoding with the provided model.
- batch_size : int, default 64¶
Batch sizes to use when encoding with the provided model.
- Returns:¶
Images as a list of original source data or embeddings as a torch.Tensor if encoded.
Targets including labels, scores as well as boxes and source indices for objects.
Metadata aggregated as a list of individual datum metadata dictionaries.
- Return type:¶
tuple[torch.Tensor | list[Any], Targets, list[dict[str, Any]]]
Note
For more on supported image classification and object detection dataset protocols, see protocol documentations for MAITE.