. -- coding: utf-8 --

Application Program Interface (API)

Data Manipulation

bob.ip.common.data.dataset

bob.ip.common.data.loader

Data loading code

bob.ip.common.data.sample

bob.ip.common.data.utils

Common utilities

bob.ip.common.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

bob.ip.binseg.data.cxr8

ChestX-ray8: Hospital-scale Chest X-ray Database

Engines

bob.ip.binseg.engine

bob.ip.binseg.engine.trainer

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.common.utils

bob.ip.common.utils.checkpointer

bob.ip.common.utils.measure

bob.ip.common.utils.plot

bob.ip.common.utils.table

bob.ip.common.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_od

DRIU Network for Optic Disc Segmentation

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.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(samples, 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
  • samples (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.common.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.common.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.common.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.common.data.dataset.JSONDataset.subsets(), or bob.ip.common.data.dataset.CSVDataset.subsets(), mapping protocol names (such as train, dev and test) to bob.ip.common.data.sample.DelayedSample lists, and a set of transforms, and returns a dictionary applying bob.ip.common.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.common.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.first_annotator_768

CHASE-DB1 dataset for Vessel Segmentation

bob.ip.binseg.configs.datasets.chasedb1.first_annotator_1024

CHASE-DB1 dataset for Vessel Segmentation

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.drive.default

DRIVE dataset for Vessel Segmentation (default protocol)

bob.ip.binseg.configs.datasets.drive.default_768

DRIVE dataset for Vessel Segmentation (Resolution used for MTL models)

bob.ip.binseg.configs.datasets.drive.default_1024

DRIVE dataset for Vessel Segmentation (Resolution used for MTL models)

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.hrf.default

HRF dataset for Vessel Segmentation (default protocol)

bob.ip.binseg.configs.datasets.hrf.default_768

HRF dataset for Vessel Segmentation

bob.ip.binseg.configs.datasets.hrf.default_1024

HRF dataset for Vessel Segmentation

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.iostar.vessel

IOSTAR dataset for Vessel Segmentation (default protocol)

bob.ip.binseg.configs.datasets.iostar.vessel_768

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.optic_disc_768

IOSTAR dataset for Optic Disc Segmentation

bob.ip.binseg.configs.datasets.iostar.optic_disc_512

IOSTAR dataset for Optic Disc Segmentation

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

COVD-IOSTAR for Vessel Segmentation

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

STARE dataset for Vessel Segmentation (annotator AH)

bob.ip.binseg.configs.datasets.stare.ah_768

STARE dataset for Vessel Segmentation (annotator AH)

bob.ip.binseg.configs.datasets.stare.ah_1024

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.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.refuge.cup_512

REFUGE dataset for Optic Cup Segmentation

bob.ip.binseg.configs.datasets.refuge.cup_768

REFUGE dataset for Optic Cup Segmentation

bob.ip.binseg.configs.datasets.refuge.disc_512

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

bob.ip.binseg.configs.datasets.refuge.disc_768

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

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.rimoner3.cup_exp1_512

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

bob.ip.binseg.configs.datasets.rimoner3.disc_exp1_512

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

bob.ip.binseg.configs.datasets.rimoner3.cup_exp1_768

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

bob.ip.binseg.configs.datasets.rimoner3.disc_exp1_768

RIM-ONE r3 for Optic Disc Segmentation (expert #1 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_all_512

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

bob.ip.binseg.configs.datasets.drishtigs1.cup_all_768

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_all_512

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

bob.ip.binseg.configs.datasets.drishtigs1.disc_all_768

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.drionsdb.expert1_512

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

bob.ip.binseg.configs.datasets.drionsdb.expert2_512

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

bob.ip.binseg.configs.datasets.drionsdb.expert1_768

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

bob.ip.binseg.configs.datasets.drionsdb.expert2_768

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.montgomery.xtest

Montgomery County cross-evaluation dataset

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

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

bob.ip.binseg.configs.datasets.jsrt.xtest

JSRT CXR cross-evaluation dataset

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)

bob.ip.binseg.configs.datasets.shenzhen.xtest

Shenzhen cross-evaluation dataset

bob.ip.binseg.configs.datasets.cxr8.default

CXR8 Dataset (default protocol)

bob.ip.binseg.configs.datasets.cxr8.idiap

CXR8 Dataset ("idiap" protocol - just like "default", but works at Idiap)

bob.ip.binseg.configs.datasets.cxr8.xtest

CXR8 cross-evaluation dataset

bob.ip.binseg.configs.datasets.cxr8.xtest_idiap

CXR8 cross-evaluation dataset with Idiap directory structure organisation