Application Program Interface (API)¶
Data Manipulation¶
Data loading code |
|
Common utilities |
|
Image transformations for our pipelines |
Datasets¶
Montgomery dataset for computer-aided diagnosis |
|
Extended Montgomery dataset for computer-aided diagnosis (extended with DensenetRS predictions) |
|
Shenzhen dataset for computer-aided diagnosis |
|
Shenzhen dataset for computer-aided diagnosis (extended with DensenetRS predictions) |
|
Indian collection dataset for computer-aided diagnosis |
|
Indian collection dataset for computer-aided diagnosis (extended with DensenetRS predictions) |
|
NIH CXR14 (relabeled) dataset for computer-aided diagnosis |
|
Padchest dataset for computer-aided diagnosis |
|
Padchest TB dataset for computer-aided diagnosis |
|
HIV-TB dataset for computer-aided diagnosis (only BMP files) |
|
HIV-TB dataset for computer-aided diagnosis (only BMP files) |
|
TB-POC dataset for computer-aided diagnosis |
|
TB-POC dataset for computer-aided diagnosis |
Engines¶
Defines functionality for the evaluation of predictions |
Neural Network Models¶
A network model that prefixes a z-normalization step to any other module |
|
Toolbox¶
Tools for interacting with the running computer or GPU |
|
Preset Configurations¶
Preset configurations for baseline systems
This module contains preset configurations for baseline FCN architectures and datasets.
Models¶
CNN for Tuberculosis Detection |
|
AlexNet |
|
AlexNet |
|
DenseNet |
|
DenseNet |
|
Feedforward network for Tuberculosis Detection |
|
Feedforward network for Tuberculosis Detection |
|
CNN for radiological findings detection |
Datasets¶
- bob.med.tb.configs.datasets.RANDOM_ROTATION = [RandomRotation(degrees=[-15.0, 15.0], interpolation=nearest, expand=False, fill=0)]¶
Shared data augmentation based on random rotation only
- bob.med.tb.configs.datasets.make_subset(l, transforms=[], prefixes=[], suffixes=[])[source]¶
Creates a new data set, applying transforms
Note
This is a convenience function for our own dataset definitions inside this module, guaranteeting homogenity between dataset definitions provided in this package. It assumes certain strategies for data augmentation that may not be translatable to other applications.
- Parameters
l (list) – List of delayed samples
transforms (list) – A list of transforms that needs to be applied to all samples in the set
prefixes (list) – A list of data augmentation operations that needs to be applied before the transforms above
suffixes (list) – A list of data augmentation operations that needs to be applied after the transforms above
- Returns
subset – A pre-formatted dataset that can be fed to one of our engines
- Return type
- bob.med.tb.configs.datasets.make_dataset(subsets_groups, transforms=[], t_transforms=[], post_transforms=[])[source]¶
Creates a new configuration dataset from a list of dictionaries and transforms
This function takes as input a list of dictionaries as those that can be returned by
bob.med.tb.data.dataset.JSONDataset.subsets()
mapping protocol names (such astrain
,dev
andtest
) tobob.med.tb.data.sample.DelayedSample
lists, and a set of transforms, and returns a dictionary applyingbob.med.tb.data.utils.SampleListDataset
to these lists, and our standard data augmentation if atrain
set exists.For example, if
subsets
is composed of two sets namedtrain
andtest
, this function will yield a dictionary with the following entries:__train__
: Wraps thetrain
subset, includes data augmentation (note: datasets with names starting with_
(underscore) are excluded from prediction and evaluation by default, as they contain data augmentation transformations.)train
: Wraps thetrain
subset, without data augmentationtest
: Wraps thetest
subset, without data augmentation
Note
This is a convenience function for our own dataset definitions inside this module, guaranteeting homogenity between dataset definitions provided in this package. It assumes certain strategies for data augmentation that may not be translatable to other applications.
- Parameters
subsets (list) – A list of dictionaries that contains the delayed sample lists for a number of named lists. The subsets will be aggregated in one final subset. If one of the keys is
train
, our standard dataset augmentation transforms are appended to the definition of that subset. All other subsets remain un-augmented.transforms (list) – A list of transforms that needs to be applied to all samples in the set
t_transforms (list) – A list of transforms that needs to be applied to the train samples
post_transforms (list) – A list of transforms that needs to be applied to all samples in the set after all the other transforms
- Returns
dataset – A pre-formatted dataset that can be fed to one of our engines. It maps string names to
bob.med.tb.data.utils.SampleListDataset
’s.- Return type
- bob.med.tb.configs.datasets.get_samples_weights(dataset)[source]¶
Compute the weights of all the samples of the dataset to balance it using the sampler of the dataloader
This function takes as input a
torch.utils.data.dataset.Dataset
and computes the weights to balance each class in the dataset and the datasets themselves if we have a ConcatDataset.- Parameters
dataset (torch.utils.data.dataset.Dataset) – An instance of torch.utils.data.dataset.Dataset ConcatDataset are supported
- Returns
samples_weights – the weights for all the samples in the dataset given as input
- Return type
- bob.med.tb.configs.datasets.get_positive_weights(dataset)[source]¶
Compute the positive weights of each class of the dataset to balance the BCEWithLogitsLoss criterion
This function takes as input a
torch.utils.data.dataset.Dataset
and computes the positive weights of each class to use them to have a balanced loss.- Parameters
dataset (torch.utils.data.dataset.Dataset) – An instance of torch.utils.data.dataset.Dataset ConcatDataset are supported
- Returns
positive_weights – the positive weight of each class in the dataset given as input
- Return type
HIV-TB dataset for TB detection (cross validation fold 0) |
|
HIV-TB dataset for TB detection (cross validation fold 0) |
|
HIV-TB dataset for TB detection (cross validation fold 1) |
|
HIV-TB dataset for TB detection (cross validation fold 1) |
|
HIV-TB dataset for TB detection (cross validation fold 2) |
|
HIV-TB dataset for TB detection (cross validation fold 2) |
|
HIV-TB dataset for TB detection (cross validation fold 3) |
|
HIV-TB dataset for TB detection (cross validation fold 3) |
|
HIV-TB dataset for TB detection (cross validation fold 4) |
|
HIV-TB dataset for TB detection (cross validation fold 4) |
|
HIV-TB dataset for TB detection (cross validation fold 5) |
|
HIV-TB dataset for TB detection (cross validation fold 5) |
|
HIV-TB dataset for TB detection (cross validation fold 6) |
|
HIV-TB dataset for TB detection (cross validation fold 6) |
|
HIV-TB dataset for TB detection (cross validation fold 7) |
|
HIV-TB dataset for TB detection (cross validation fold 7) |
|
HIV-TB dataset for TB detection (cross validation fold 8) |
|
HIV-TB dataset for TB detection (cross validation fold 8) |
|
HIV-TB dataset for TB detection (cross validation fold 9) |
|
HIV-TB dataset for TB detection (cross validation fold 9) |
|
HIV-TB dataset for TB detection (cross validation fold 0) |
|
HIV-TB dataset for TB detection (cross validation fold 1) |
|
HIV-TB dataset for TB detection (cross validation fold 2) |
|
HIV-TB dataset for TB detection (cross validation fold 3) |
|
HIV-TB dataset for TB detection (cross validation fold 4) |
|
HIV-TB dataset for TB detection (cross validation fold 5) |
|
HIV-TB dataset for TB detection (cross validation fold 6) |
|
HIV-TB dataset for TB detection (cross validation fold 7) |
|
HIV-TB dataset for TB detection (cross validation fold 8) |
|
HIV-TB dataset for TB detection (cross validation fold 9) |
|
Indian dataset for TB detection (default protocol) |
|
Indian dataset for TB detection (cross validation fold 0) |
|
Indian dataset for TB detection (cross validation fold 0, RGB) |
|
Indian dataset for TB detection (cross validation fold 1) |
|
Indian dataset for TB detection (cross validation fold 1, RGB) |
|
Indian dataset for TB detection (cross validation fold 2) |
|
Indian dataset for TB detection (cross validation fold 2, RGB) |
|
Indian dataset for TB detection (cross validation fold 3) |
|
Indian dataset for TB detection (cross validation fold 3, RGB) |
|
Indian dataset for TB detection (cross validation fold 4) |
|
Indian dataset for TB detection (cross validation fold 4, RGB) |
|
Indian dataset for TB detection (cross validation fold 5) |
|
Indian dataset for TB detection (cross validation fold 5, RGB) |
|
Indian dataset for TB detection (cross validation fold 6) |
|
Indian dataset for TB detection (cross validation fold 6, RGB) |
|
Indian dataset for TB detection (cross validation fold 7) |
|
Indian dataset for TB detection (cross validation fold 7, RGB) |
|
Indian dataset for TB detection (cross validation fold 8) |
|
Indian dataset for TB detection (cross validation fold 8, RGB) |
|
Indian dataset for TB detection (cross validation fold 9) |
|
Indian dataset for TB detection (cross validation fold 9, RGB) |
|
Indian dataset for TB detection (default protocol, converted in RGB) |
|
Indian dataset for TB detection (default protocol) (extended with DensenetRS predictions) |
|
Indian dataset for TB detection (cross validation fold 0) |
|
Indian dataset for TB detection (cross validation fold 1) |
|
Indian dataset for TB detection (cross validation fold 2) |
|
Indian dataset for TB detection (cross validation fold 3) |
|
Indian dataset for TB detection (cross validation fold 4) |
|
Indian dataset for TB detection (cross validation fold 5) |
|
Indian dataset for TB detection (cross validation fold 6) |
|
Indian dataset for TB detection (cross validation fold 7) |
|
Indian dataset for TB detection (cross validation fold 8) |
|
Indian dataset for TB detection (cross validation fold 9) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 0) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 0, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 1) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 1, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 2) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 2, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 3) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 3, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 4) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 4, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 5) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 5, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 6) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 6, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 7) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 7, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 8) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 8, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 9) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 9, RGB) |
|
Aggregated dataset composed of Montgomery and Shenzhen (RGB) datasets |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 0) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 1) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 2) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 3) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 4) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 5) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 6) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 7) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 8) |
|
Aggregated dataset composed of Montgomery and Shenzhen datasets (cross validation fold 9) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 0) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 0, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 1) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 1, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 2) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 2, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 3) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 3, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 4) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 4, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 5) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 5, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 6) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 6, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 7) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 7, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 8) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 8, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 9) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 9, RGB) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian (RGB) datasets |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 0) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 1) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 2) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 3) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 4) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 5) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 6) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 7) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 8) |
|
Aggregated dataset composed of Montgomery, Shenzhen and Indian datasets (cross validation fold 9) |
|
Aggregated dataset composed of Montgomery, Shenzhen, Indian and Padchest datasets |
|
Aggregated dataset composed of Montgomery, Shenzhen, Indian and Padchest (RGB) datasets |
|
Aggregated dataset composed of Montgomery, Shenzhen, Indian and PadChest (TB) datasets |
|
Montgomery dataset for TB detection (default protocol) |
|
Montgomery dataset for TB detection (cross validation fold 0) |
|
Montgomery dataset for TB detection (cross validation fold 0, RGB) |
|
Montgomery dataset for TB detection (cross validation fold 1) |
|
Montgomery dataset for TB detection (cross validation fold 1, RGB) |
|
Montgomery dataset for TB detection (cross validation fold 2) |
|
Montgomery dataset for TB detection (cross validation fold 2, RGB) |
|
Montgomery dataset for TB detection (cross validation fold 3) |
|
Montgomery dataset for TB detection (cross validation fold 3, RGB) |
|
Montgomery dataset for TB detection (cross validation fold 4) |
|
Montgomery dataset for TB detection (cross validation fold 4, RGB) |
|
Montgomery dataset for TB detection (cross validation fold 5) |
|
Montgomery dataset for TB detection (cross validation fold 5, RGB) |
|
Montgomery dataset for TB detection (cross validation fold 6) |
|
Montgomery dataset for TB detection (cross validation fold 6, RGB) |
|
Montgomery dataset for TB detection (cross validation fold 7) |
|
Montgomery dataset for TB detection (cross validation fold 7, RGB) |
|
Montgomery dataset for TB detection (cross validation fold 8) |
|
Montgomery dataset for TB detection (cross validation fold 8, RGB) |
|
Montgomery dataset for TB detection (cross validation fold 9) |
|
Montgomery dataset for TB detection (cross validation fold 9, RGB) |
|
Montgomery dataset for TB detection (default protocol, converted in RGB) |
|
Montgomery dataset for TB detection (default protocol) (extended with DensenetRS predictions) |
|
Montgomery dataset for TB detection (cross validation fold 0) |
|
Montgomery dataset for TB detection (cross validation fold 1) |
|
Montgomery dataset for TB detection (cross validation fold 2) |
|
Montgomery dataset for TB detection (cross validation fold 3) |
|
Montgomery dataset for TB detection (cross validation fold 4) |
|
Montgomery dataset for TB detection (cross validation fold 5) |
|
Montgomery dataset for TB detection (cross validation fold 6) |
|
Montgomery dataset for TB detection (cross validation fold 7) |
|
Montgomery dataset for TB detection (cross validation fold 8) |
|
Montgomery dataset for TB detection (cross validation fold 9) |
|
NIH CXR14 (relabeled, idiap protocol) dataset for computer-aided diagnosis |
|
NIH CXR14 (relabeled) dataset for computer-aided diagnosis |
|
NIH CXR14 (relabeled, idiap protocol) dataset for computer-aided diagnosis |
|
Aggregated dataset composed of NIH CXR14 relabeld and PadChest (normalized) datasets |
|
Padchest cardiomegaly (idiap protocol) dataset for computer-aided diagnosis |
|
Padchest (idiap protocol) dataset for computer-aided diagnosis |
|
Padchest tuberculosis (no TB idiap protocol) dataset for computer-aided diagnosis |
|
Padchest tuberculosis (idiap protocol) dataset for computer-aided diagnosis |
|
Padchest tuberculosis (idiap protocol, rgb) dataset for computer-aided diagnosis |
|
Extended Padchest TB dataset for TB detection (default protocol) (extended with DensenetRS predictions) |
|
Shenzhen dataset for TB detection (default protocol) |
|
Shenzhen dataset for TB detection (cross validation fold 0) |
|
Shenzhen dataset for TB detection (cross validation fold 0, RGB) |
|
Shenzhen dataset for TB detection (cross validation fold 1) |
|
Shenzhen dataset for TB detection (cross validation fold 1, RGB) |
|
Shenzhen dataset for TB detection (cross validation fold 2) |
|
Shenzhen dataset for TB detection (cross validation fold 2, RGB) |
|
Shenzhen dataset for TB detection (cross validation fold 3) |
|
Shenzhen dataset for TB detection (cross validation fold 3, RGB) |
|
Shenzhen dataset for TB detection (cross validation fold 4) |
|
Shenzhen dataset for TB detection (cross validation fold 4, RGB) |
|
Shenzhen dataset for TB detection (cross validation fold 5) |
|
Shenzhen dataset for TB detection (cross validation fold 5, RGB) |
|
Shenzhen dataset for TB detection (cross validation fold 6) |
|
Shenzhen dataset for TB detection (cross validation fold 6, RGB) |
|
Shenzhen dataset for TB detection (cross validation fold 7) |
|
Shenzhen dataset for TB detection (cross validation fold 7, RGB) |
|
Shenzhen dataset for TB detection (cross validation fold 8) |
|
Shenzhen dataset for TB detection (cross validation fold 8, RGB) |
|
Shenzhen dataset for TB detection (cross validation fold 9) |
|
Shenzhen dataset for TB detection (cross validation fold 9, RGB) |
|
Shenzhen dataset for TB detection (default protocol, converted in RGB) |
|
Shenzhen dataset for TB detection (default protocol) (extended with DensenetRS predictions) |
|
Shenzhen dataset for TB detection (cross validation fold 0) |
|
Shenzhen dataset for TB detection (cross validation fold 1) |
|
Shenzhen dataset for TB detection (cross validation fold 2) |
|
Shenzhen dataset for TB detection (cross validation fold 3) |
|
Shenzhen dataset for TB detection (cross validation fold 4) |
|
Shenzhen dataset for TB detection (cross validation fold 5) |
|
Shenzhen dataset for TB detection (cross validation fold 6) |
|
Shenzhen dataset for TB detection (cross validation fold 7) |
|
Shenzhen dataset for TB detection (cross validation fold 8) |
|
Shenzhen dataset for TB detection (cross validation fold 9) |
|
TB-POC dataset for TB detection (cross validation fold 0) |
|
TB-POC dataset for TB detection (cross validation fold 0) |
|
TB-POC dataset for TB detection (cross validation fold 1) |
|
TB-POC dataset for TB detection (cross validation fold 1) |
|
TB-POC dataset for TB detection (cross validation fold 2) |
|
TB-POC dataset for TB detection (cross validation fold 2) |
|
TB-POC dataset for TB detection (cross validation fold 3) |
|
TB-POC dataset for TB detection (cross validation fold 3) |
|
TB-POC dataset for TB detection (cross validation fold 4) |
|
TB-POC dataset for TB detection (cross validation fold 4) |
|
TB-POC dataset for TB detection (cross validation fold 5) |
|
TB-POC dataset for TB detection (cross validation fold 5) |
|
TB-POC dataset for TB detection (cross validation fold 6) |
|
TB-POC dataset for TB detection (cross validation fold 6) |
|
TB-POC dataset for TB detection (cross validation fold 7) |
|
TB-POC dataset for TB detection (cross validation fold 7) |
|
TB-POC dataset for TB detection (cross validation fold 8) |
|
TB-POC dataset for TB detection (cross validation fold 8) |
|
TB-POC dataset for TB detection (cross validation fold 9) |
|
TB-POC dataset for TB detection (cross validation fold 9) |
|
TB-POC dataset for TB detection (cross validation fold 0) |
|
TB-POC dataset for TB detection (cross validation fold 1) |
|
TB-POC dataset for TB detection (cross validation fold 2) |
|
TB-POC dataset for TB detection (cross validation fold 3) |
|
TB-POC dataset for TB detection (cross validation fold 4) |
|
TB-POC dataset for TB detection (cross validation fold 5) |
|
TB-POC dataset for TB detection (cross validation fold 6) |
|
TB-POC dataset for TB detection (cross validation fold 7) |
|
TB-POC dataset for TB detection (cross validation fold 8) |
|
TB-POC dataset for TB detection (cross validation fold 9) |