msdnet.loggers module

Module for logging progress during training.

class msdnet.loggers.Logger(*args, onlyifbetter=False, **kwargs)[source]

Bases: abc.ABC

Base logger class

Logs progress of validation set during training.

abstract makelog(v)[source]

Logs progress of validation set. To be implemented by each class.

Parameters

v – validation set

abstract initialize(*args, **kwargs)[source]

Initialize logger.

log(v)[source]

Logs progress of validation set.

Parameters

v – validation set

class msdnet.loggers.ConsoleLogger(*args, onlyifbetter=False, **kwargs)[source]

Bases: msdnet.loggers.Logger

Output error values to the console.

initialize()[source]

Initialize logger.

makelog(v)[source]

Logs progress of validation set. To be implemented by each class.

Parameters

v – validation set

class msdnet.loggers.FileLogger(*args, onlyifbetter=False, **kwargs)[source]

Bases: msdnet.loggers.Logger

Output error values to a file.

initialize(fn)[source]

Initialize logger.

Parameters

fn – Filename to log error values to.

makelog(v)[source]

Logs progress of validation set. To be implemented by each class.

Parameters

v – validation set

msdnet.loggers.getheaderimage(width)[source]

Return image header.

Parameters

width – width of image

msdnet.loggers.stitchimages(ims, imsize=None, scaleoutput=True)[source]

Stitch three images (input, target, output).

Parameters
  • ims – list of images to stitch

  • imsize – (optional) Maximum size of image

  • scaleoutput – (optional) whether to scale output image to target image range

class msdnet.loggers.ImageLogger(*args, onlyifbetter=False, **kwargs)[source]

Bases: msdnet.loggers.Logger

Output best, worst, and typical images for validation set.

initialize(fn, chan_in=0, chan_out=0, imsize=512)[source]

Initialize logger.

Parameters
  • fn – base filename to output images to.

  • chan_in – input channel to show

  • chan_out – output channel to show

  • imsize – maximum image size to output

toimage(ims)[source]
makelog(v)[source]

Logs progress of validation set. To be implemented by each class.

Parameters

v – validation set

class msdnet.loggers.ImageLabelLogger(*args, onlyifbetter=False, **kwargs)[source]

Bases: msdnet.loggers.Logger

Output best, worst, and typical images for validation set for segmentation problems.

initialize(fn, chan_in=0, imsize=512)[source]

Initialize logger.

Parameters
  • fn – base filename to output images to.

  • chan_in – input channel to show

  • imsize – maximum image size to output

toimage(ims)[source]
makelog(v)[source]

Logs progress of validation set. To be implemented by each class.

Parameters

v – validation set