ROIDataset

Dataset of image regions (ROIs) and integer class labels.

Usage

Source

ROIDataset(
    rois,
    labels,
    transform=None,
)

Parameters

rois: npt.NDArray[np.uint8]

Images array of shape (N, C, Y, X).

labels: npt.NDArray[np.int_]

Integer class labels of shape (N,).

transform: Callable[[torch.Tensor], torch.Tensor] | None = None
Optional transform applied to each ROI tensor.

Methods

Name Description
__getitem__() Return the ROI tensor and label tensor at the given index.
__init__() Initialise the dataset with ROI images and class labels.
__len__() Return the number of samples in the dataset.

__getitem__()

Return the ROI tensor and label tensor at the given index.

Usage

Source

__getitem__(index)

__init__()

Initialise the dataset with ROI images and class labels.

Usage

Source

__init__(rois, labels, transform=None)

__len__()

Return the number of samples in the dataset.

Usage

Source

__len__()