biodatasets Module

biodatasets module provides classes to load public biomedical datasets in a PyTorch friendly manner.

ChestXrayDataset class

class farabio.data.biodatasets.ChestXrayDataset(root: str, mode: str = 'train', shape: int = 256, transform=None, target_transform=None, download: bool = True)[source]

Chest X-ray dataset class

Kaggle Chest X-Ray Images competition dataset to detect pneumonia from [1].

References

1

https://www.kaggle.com/paultimothymooney/chest-xray-pneumonia

Examples

>>> train_dataset = ChestXrayDataset(root=".", transform=None, download=True)
>>> train_dataset.visualize_dataset()
../_images/ChestXrayDataset.png
__init__(root: str, mode: str = 'train', shape: int = 256, transform=None, target_transform=None, download: bool = True)[source]

Initialize self. See help(type(self)) for accurate signature.

get_train_transform(img_shape)[source]

Albumentations transform

static imshow(inp, title=None)[source]
visualize_dataset()[source]

Function to visualize images and masks

DSB18Dataset class

class farabio.data.biodatasets.DSB18Dataset(root: str, train: bool = True, shape: int = 512, transform=None, download: bool = True)[source]

Nuclei segmentation dataset class

Kaggle 2018 Data Science Bowl competition dataset for segmented nuclei images from [1].

References

1

https://www.kaggle.com/c/data-science-bowl-2018/overview

Examples

>>> train_dataset = DSB18Dataset(root=".", transform=None, download=False)
>>> train_dataset.visualize_dataset(5)
../_images/DSB18Dataset.png
__init__(root: str, train: bool = True, shape: int = 512, transform=None, download: bool = True)[source]

Initialize self. See help(type(self)) for accurate signature.

get_mask(mask_folder, IMG_HEIGHT, IMG_WIDTH)[source]
get_train_transform(img_shape)[source]

Albumentations transform

static format_image(img)[source]
static format_mask(mask)[source]
visualize_dataset(n_images, predict=None)[source]

Function to visualize images and masks

HistocancerDataset class

class farabio.data.biodatasets.HistocancerDataset(root: str, train: bool = True, transform=None, download: bool = True)[source]

Histopathologic Cancer Dataset class

Kaggle Histopathologic Cancer Detection dataset from [1]

References

1

<https://www.kaggle.com/c/histopathologic-cancer-detection/data>`_

Examples

>>> train_dataset = HistocancerDataset(root=".", download=True, train=True)
>>> train_dataset.visualize_dataset()
../_images/HistocancerDataset.png
__init__(root: str, train: bool = True, transform=None, download: bool = True)[source]

Initialize self. See help(type(self)) for accurate signature.

static get_train_transform(self)[source]

Default transform for training data

static get_valid_transform(self)[source]

Default transform for validation data

visualize_dataset(n_images=10)[source]

RANZCRDataset class

class farabio.data.biodatasets.RANZCRDataset(root: str, train: bool = True, transform=None, download: bool = False)[source]

RANZCR 2021 dataset class

Catheters presence and position detection from RANZCR CLiP - Catheter and Line Position Challenge from [1]

References

1

https://www.kaggle.com/c/ranzcr-clip-catheter-line-classification/data

Examples

>>> train_dataset = RANZCRDataset(".", train=True, transform=None, download=True)
>>> train_dataset.visualize_dataset()
../_images/RANZCRDataset.png
__init__(root: str, train: bool = True, transform=None, download: bool = False)[source]

Initialize self. See help(type(self)) for accurate signature.

get_transform()[source]

Default transform

visualize_dataset(n_images=5)[source]

RetinopathyDataset class

class farabio.data.biodatasets.RetinopathyDataset(root: str, train: bool = True, download: bool = True, transform=None)[source]

Retinopathy Dataset class

Retina images taken using fundus photography from Kaggle APTOS 2019 Blindness Detection competition, [1].

References

1

<https://www.kaggle.com/c/aptos2019-blindness-detection/data>`_

Examples

>>> train_dataset = RetinopathyDataset(root=".", transform=None, download=True)
>>> train_dataset.visualize_dataset(9)
../_images/RetinopathyDataset.png
__init__(root: str, train: bool = True, download: bool = True, transform=None)[source]

Initialize self. See help(type(self)) for accurate signature.

visualize_dataset(n_images=9)[source]

Function to visualize blindness images