mednet.data.segment.drive

DRIVE dataset for vessel segmentation.

The DRIVE database has been established to enable comparative studies on segmentation of blood vessels in retinal images. The database contains annotations from 2 different experts (only for the test set).

  • Database reference: [SAN+04]

Data specifications:

  • Raw data input (on disk):

    • RGB images encoded in TIFF format with resolution (HxW) = 584 x 565 pixels

    • Total samples: 40

  • Output sample:

    • Image: Load raw TIFF images with PIL, with auto-conversion to RGB.

    • Vessel annotations: Load annotations with PIL, with auto-conversion to model 1 with no dithering.

    • Eye fundus mask: Load mask with PIL, with auto-conversion to model 1 with no dithering.

Split default includes 20 images for training and another 20 for testing. Split second-annotator includes only the 20 test images with different vessel annotations (expert 2).

This module contains the base declaration of common data modules and raw-data loaders for this database. All configured splits inherit from this definition.

Module Attributes

DATABASE_SLUG

Pythonic name to refer to this database.

CONFIGURATION_KEY_DATADIR

Key to search for in the configuration file for the root directory of this database.

Classes

DataModule(split_path)

DRIVE dataset for Vessel Segmentation.

RawDataLoader()

A specialized raw-data-loader for the Drive dataset.

mednet.data.segment.drive.DATABASE_SLUG = 'drive'

Pythonic name to refer to this database.

mednet.data.segment.drive.CONFIGURATION_KEY_DATADIR = 'datadir.drive'

Key to search for in the configuration file for the root directory of this database.

class mednet.data.segment.drive.RawDataLoader[source]

Bases: RawDataLoader

A specialized raw-data-loader for the Drive dataset.

datadir: Path

This variable contains the base directory where the database raw data is stored.

sample(sample)[source]

Load a single image sample from the disk.

Parameters:

sample (Any) – A tuple containing path suffixes to the sample image, target, and mask to be loaded, within the dataset root folder.

Return type:

Mapping[str, Any]

Returns:

The sample representation.

target(sample)[source]

Load only sample target from its raw representation.

Parameters:

sample (Any) – A tuple containing the path suffix, within the dataset root folder, where to find the image to be loaded, and an integer, representing the sample target.

Return type:

Tensor

Returns:

The label corresponding to the specified sample, encapsulated as a torch float tensor.

class mednet.data.segment.drive.DataModule(split_path)[source]

Bases: CachingDataModule

DRIVE dataset for Vessel Segmentation.

Parameters:

split_path (Path | Traversable) – Path or traversable (resource) with the JSON split description to load.