Python API

Database

class bob.db.chasedb1.query.FileList(db_json)[source]

Bases: object

FileList object that loads the protocol as defined in a json file. Provides a __getitem__ interface.

class bob.db.chasedb1.query.Database(protocol='default')[source]

Bases: object

A low level database interface to be used with PyTorch or other deep learning frameworks.

Parameters

protocol (str) – protocol defining the train-test split.

property paths

returns: paths – list of all paths of all samples :rtype: list

samples(split=None)[source]

Given a split, returns a list of Sample objects.

Parameters

split (str) – ‘train’, ‘test’ or None (returns all samples)

Returns

samples – list of Sample objects

Return type

list

Sample

class bob.db.chasedb1.models.FundusImage(path)[source]

Bases: object

Generic fundus image object.

property basename

Returns the file name

Returns

name

Return type

str

property size

returns: size – the fundus image resolution in (W, H). :rtype: tuple

pil_image(datadir=None)[source]
Returns

img

Return type

PIL.Image.Image

class bob.db.chasedb1.models.GroundTruth(path, threshold=None, drawsize=None)[source]

Bases: object

Generic ground truth object.

  • Allows for thresholding in case there are multiple ground truth annotations in one bitmap

  • Allows for “on-the-fly” drawing of ground truth annotations with a specified size

Parameters
  • path (str) – relative path to the file on disk

  • threshold (float) – in range [0,1] used to threshold ground-truth image data with multiple classes e.g. optic disc and cup

  • drawsize (tuple) – size tuple in pillow (W, H) format. Used for cases where drawing of gt is required

property basename

Returns the file name

Returns

name

Return type

str

property size

Retirms the ground truth image resolution in (W, H).

Returns

size

Return type

tuple

pil_image(datadir=None)[source]
Returns

gt – mode = ‘1’

Return type

PIL.Image.Image

class bob.db.chasedb1.models.Sample(img, gt)[source]

Bases: object

Generic Sample object

High level sample class that combines the objects ‘FundusImage’ and ‘GroundTruth’ Allows for access of the subclass, e.g. :

>>> img = FundusImage('path/to/some_img.file')
>>> gt = GroundTruth('path/to/some_gt.file')
>>> mysample = Sample(img, gt)
>>> mysample.img.basename
'some_img.file'
>>> mysample.gt.basename
'some_gt.file'
>>>
Parameters
property paths

returns: paths – paths of image, ground truth :rtype: list