Application Program Interface (API)

Data Manipulation

bob.ip.binseg.data.dataset

bob.ip.binseg.data.loader

Data loading code

bob.ip.binseg.data.sample

bob.ip.binseg.data.utils

Common utilities

bob.ip.binseg.data.transforms

Image transformations for our pipelines

Datasets

Retinography

bob.ip.binseg.data.drive

DRIVE dataset for Vessel Segmentation

bob.ip.binseg.data.stare

STARE dataset for Vessel Segmentation

bob.ip.binseg.data.chasedb1

CHASE-DB1 dataset for Vessel Segmentation

bob.ip.binseg.data.hrf

HRF dataset for Vessel Segmentation

bob.ip.binseg.data.iostar

IOSTAR (training set) for Vessel and Optic-Disc Segmentation

bob.ip.binseg.data.refuge

REFUGE for Optic Disc and Cup Segmentation

bob.ip.binseg.data.drishtigs1

Drishti-GS1 for Optic Disc and Cup Segmentation

bob.ip.binseg.data.rimoner3

RIM-ONE r3 (training set) for Cup Segmentation

bob.ip.binseg.data.drionsdb

DRIONS-DB (training set) for Optic Disc Segmentation

bob.ip.binseg.data.drhagis

DRHAGIS dataset for Vessel Segmentation

Chest X-Ray

bob.ip.binseg.data.montgomery

Montgomery County dataset for Lung Segmentation

bob.ip.binseg.data.jsrt

Japanese Society of Radiological Technology dataset for Lung Segmentation

bob.ip.binseg.data.shenzhen

Shenzhen No.3 People’s Hospital dataset for Lung Segmentation

Engines

bob.ip.binseg.engine

bob.ip.binseg.engine.trainer

bob.ip.binseg.engine.ssltrainer

bob.ip.binseg.engine.predictor

bob.ip.binseg.engine.evaluator

Defines functionality for the evaluation of predictions

bob.ip.binseg.engine.adabound

Implementation of the AdaBound optimizer <https://github.com/Luolc/AdaBound/blob/master/adabound/adabound.py>.

Neural Network Models

bob.ip.binseg.models

bob.ip.binseg.models.backbones

bob.ip.binseg.models.backbones.mobilenetv2

bob.ip.binseg.models.backbones.resnet

bob.ip.binseg.models.backbones.vgg

bob.ip.binseg.models.normalizer

A network model that prefixes a z-normalization step to any other module

bob.ip.binseg.models.driu

bob.ip.binseg.models.driu_bn

bob.ip.binseg.models.driu_od

bob.ip.binseg.models.driu_pix

bob.ip.binseg.models.hed

bob.ip.binseg.models.m2unet

bob.ip.binseg.models.resunet

bob.ip.binseg.models.unet

bob.ip.binseg.models.lwnet

Little W-Net

bob.ip.binseg.models.losses

Loss implementations

bob.ip.binseg.models.make_layers

Toolbox

bob.ip.binseg.utils

bob.ip.binseg.utils.checkpointer

bob.ip.binseg.utils.measure

bob.ip.binseg.utils.plot

bob.ip.binseg.utils.table

bob.ip.binseg.utils.summary

Preset Configurations

Preset configurations for baseline systems

This module contains preset configurations for baseline FCN architectures and datasets.

Models

bob.ip.binseg.configs.models.driu

DRIU Network for Vessel Segmentation

bob.ip.binseg.configs.models.driu_bn

DRIU Network for Vessel Segmentation with Batch Normalization

bob.ip.binseg.configs.models.driu_bn_ssl

DRIU Network for Vessel Segmentation using SSL and Batch Normalization

bob.ip.binseg.configs.models.driu_od

DRIU Network for Optic Disc Segmentation

bob.ip.binseg.configs.models.driu_ssl

DRIU Network for Vessel Segmentation using SSL

bob.ip.binseg.configs.models.hed

HED Network for image segmentation

bob.ip.binseg.configs.models.m2unet

MobileNetV2 U-Net model for image segmentation

bob.ip.binseg.configs.models.m2unet_ssl

MobileNetV2 U-Net model for image segmentation using SSL

bob.ip.binseg.configs.models.resunet

Residual U-Net for image segmentation

bob.ip.binseg.configs.models.unet

U-Net for image segmentation

bob.ip.binseg.configs.models.lwnet

Little W-Net for image segmentation

Datasets

Standard configurations for dataset setup

bob.ip.binseg.configs.datasets.RANDOM_ROTATION = [RandomRotation(p=0.5,degrees=[-15.0, 15.0], interpolation=bilinear, expand=False, fill=0)]

Shared data augmentation based on random rotation only

bob.ip.binseg.configs.datasets.RANDOM_FLIP_JITTER = [RandomHorizontalFlip(p=0.5), RandomVerticalFlip(p=0.5), ColorJitter(p=0.5,brightness=[0.7, 1.3], contrast=[0.7, 1.3], saturation=[0.98, 1.02], hue=[-0.02, 0.02])]

Shared data augmentation transforms without random rotation

bob.ip.binseg.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.ip.binseg.data.utils.SampleListDataset

bob.ip.binseg.configs.datasets.augment_subset(s, rotation_before=False)[source]

Creates a new subset set, with data augmentation

Typically, the transforms are chained to a default set of data augmentation operations (random rotation, horizontal and vertical flips, and color jitter), but a flag allows prefixing the rotation specially (useful for some COVD training sets).

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
  • s (bob.ip.binseg.data.utils.SampleListDataset) – A dataset that will be augmented

  • rotation_before (py:class:bool, Optional) – A optional flag allowing you to do a rotation augmentation transform before the sequence of transforms for this dataset, that will be augmented.

Returns

subset – A pre-formatted dataset that can be fed to one of our engines

Return type

bob.ip.binseg.data.utils.SampleListDataset

bob.ip.binseg.configs.datasets.make_dataset(subsets, transforms)[source]

Creates a new configuration dataset from dictionary and transforms

This function takes as input a dictionary as those that can be returned by bob.ip.binseg.data.dataset.JSONDataset.subsets(), or bob.ip.binseg.data.dataset.CSVDataset.subsets(), mapping protocol names (such as train, dev and test) to bob.ip.binseg.data.sample.DelayedSample lists, and a set of transforms, and returns a dictionary applying bob.ip.binseg.data.utils.SampleListDataset to these lists, and our standard data augmentation if a train set exists.

For example, if subsets is composed of two sets named train and test, this function will yield a dictionary with the following entries:

  • __train__: Wraps the train 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 the train subset, without data augmentation

  • train: Wraps the test 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 (dict) – A dictionary that contains the delayed sample lists for a number of named lists. 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. If one of the keys is validation, then this dataset will be also copied to the __valid__ hidden dataset and will be used for validation during training. Otherwise, if no valid subset is available, we set __valid__ to be the same as the unaugmented train subset, if one is available.

  • transforms (list) – A list of transforms that needs to be applied to all samples in the set

Returns

dataset – A pre-formatted dataset that can be fed to one of our engines. It maps string names to bob.ip.binseg.data.utils.SampleListDataset’s.

Return type

dict

bob.ip.binseg.configs.datasets.csv

Example CSV-based custom filelist dataset

bob.ip.binseg.configs.datasets.chasedb1.first_annotator

CHASE-DB1 dataset for Vessel Segmentation (first-annotator protocol)

bob.ip.binseg.configs.datasets.chasedb1.second_annotator

CHASE-DB1 dataset for Vessel Segmentation (second-annotator protocol)

bob.ip.binseg.configs.datasets.chasedb1.xtest

CHASE-DB1 cross-evaluation dataset

bob.ip.binseg.configs.datasets.chasedb1.mtest

CHASE-DB1 cross-evaluation dataset with matched resolution

bob.ip.binseg.configs.datasets.chasedb1.covd

COVD-CHASEDB1 for Vessel Segmentation

bob.ip.binseg.configs.datasets.chasedb1.ssl

COVD-CHASE-DB1 + SSL for Vessel Segmentation

bob.ip.binseg.configs.datasets.drive.default

DRIVE dataset for Vessel Segmentation (default protocol)

bob.ip.binseg.configs.datasets.drive.second_annotator

DRIVE dataset for Vessel Segmentation (second annotation: test only)

bob.ip.binseg.configs.datasets.drive.xtest

DRIVE cross-evaluation dataset

bob.ip.binseg.configs.datasets.drive.mtest

DRIVE cross-evaluation dataset with matched resolution

bob.ip.binseg.configs.datasets.drive.covd

COVD-DRIVE for Vessel Segmentation

bob.ip.binseg.configs.datasets.drive.ssl

COVD-DRIVE + SSL for Vessel Segmentation

bob.ip.binseg.configs.datasets.hrf.default

HRF dataset for Vessel Segmentation (default protocol)

bob.ip.binseg.configs.datasets.hrf.xtest

HRF cross-evaluation dataset

bob.ip.binseg.configs.datasets.hrf.mtest

HRF cross-evaluation dataset with matched resolution

bob.ip.binseg.configs.datasets.hrf.default_fullres

HRF dataset for Vessel Segmentation (default protocol)

bob.ip.binseg.configs.datasets.hrf.covd

COVD-HRF for Vessel Segmentation

bob.ip.binseg.configs.datasets.hrf.ssl

COVD-HRF + SSL for Vessel Segmentation

bob.ip.binseg.configs.datasets.iostar.vessel

IOSTAR dataset for Vessel Segmentation (default protocol)

bob.ip.binseg.configs.datasets.iostar.vessel_xtest

IOSTAR vessel cross-evaluation dataset

bob.ip.binseg.configs.datasets.iostar.vessel_mtest

IOSTAR vessel cross-evaluation dataset with matched resolution

bob.ip.binseg.configs.datasets.iostar.optic_disc

IOSTAR dataset for Optic Disc Segmentation (default protocol)

bob.ip.binseg.configs.datasets.iostar.covd

COVD-IOSTAR for Vessel Segmentation

bob.ip.binseg.configs.datasets.iostar.ssl

COVD-IOSTAR + SSL for Vessel Segmentation

bob.ip.binseg.configs.datasets.stare.ah

STARE dataset for Vessel Segmentation (annotator AH)

bob.ip.binseg.configs.datasets.stare.vk

STARE dataset for Vessel Segmentation (annotator VK)

bob.ip.binseg.configs.datasets.stare.xtest

STARE cross-evaluation dataset

bob.ip.binseg.configs.datasets.stare.mtest

STARE cross-evaluation dataset with matched resolution

bob.ip.binseg.configs.datasets.stare.covd

COVD-STARE for Vessel Segmentation

bob.ip.binseg.configs.datasets.stare.ssl

COVD-STARE + SSL (training set) for Vessel Segmentation

bob.ip.binseg.configs.datasets.refuge.cup

REFUGE dataset for Optic Cup Segmentation (default protocol)

bob.ip.binseg.configs.datasets.refuge.disc

REFUGE dataset for Optic Disc Segmentation (default protocol)

bob.ip.binseg.configs.datasets.rimoner3.cup_exp1

RIM-ONE r3 for Optic Cup Segmentation (expert #1 annotations)

bob.ip.binseg.configs.datasets.rimoner3.cup_exp2

RIM-ONE r3 for Optic Cup Segmentation (expert #2 annotations)

bob.ip.binseg.configs.datasets.rimoner3.disc_exp1

RIM-ONE r3 for Optic Disc Segmentation (expert #1 annotations)

bob.ip.binseg.configs.datasets.rimoner3.disc_exp2

RIM-ONE r3 for Optic Disc Segmentation (expert #2 annotations)

bob.ip.binseg.configs.datasets.drishtigs1.cup_all

DRISHTI-GS1 dataset for Cup Segmentation (agreed by all annotators)

bob.ip.binseg.configs.datasets.drishtigs1.cup_any

DRISHTI-GS1 dataset for Cup Segmentation (agreed by any annotator)

bob.ip.binseg.configs.datasets.drishtigs1.disc_all

DRISHTI-GS1 dataset for Optic Disc Segmentation (agreed by all annotators)

bob.ip.binseg.configs.datasets.drishtigs1.disc_any

DRISHTI-GS1 dataset for Optic Disc Segmentation (agreed by any annotator)

bob.ip.binseg.configs.datasets.drionsdb.expert1

DRIONS-DB for Optic Disc Segmentation (expert #1 annotations)

bob.ip.binseg.configs.datasets.drionsdb.expert2

DRIONS-DB for Optic Disc Segmentation (expert #2 annotations)

bob.ip.binseg.configs.datasets.drhagis.default

DRHAGIS dataset for Vessel Segmentation (default protocol)

bob.ip.binseg.configs.datasets.montgomery.default

Montgomery County dataset for Lung Segmentation (default protocol)

bob.ip.binseg.configs.datasets.jsrt.default

Japanese Society of Radiological Technology dataset for Lung Segmentation (default protocol)

bob.ip.binseg.configs.datasets.shenzhen.default

Shenzhen dataset for Lung Segmentation (default protocol)

bob.ip.binseg.configs.datasets.shenzhen.default_256

Shenzhen dataset for Lung Segmentation (default protocol)