collate
orchard.data_handler.collate
¶
Detection Collate Function.
Detection models expect list[Tensor] images and list[dict] targets
rather than stacked tensor batches. This module provides the custom collate
function for detection DataLoaders.
detection_collate_fn(batch)
¶
Collate detection samples into list-based batches.
Unlike the default PyTorch collate (which stacks tensors), detection requires list-based batching because each image can have a different number of bounding boxes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch
|
list[tuple[Tensor, dict[str, Any]]]
|
List of (image, target_dict) tuples from the dataset. |
required |
Returns:
| Type | Description |
|---|---|
tuple[list[Tensor], list[dict[str, Any]]]
|
Tuple of (list of image tensors, list of target dicts). |