dacapo.experiments.trainers.gp_augments

Submodules

Classes

AugmentConfig

Base class for gunpowder augment configurations. Each subclass of a Augment

ElasticAugmentConfig

A class that holds the configuration details for the elastic augmentations.

SimpleAugmentConfig

This class is an implementation of AugmentConfig that applies simple augmentations.

GammaAugmentConfig

This class manages the configuration of gamma augmentation for a given dataset.

IntensityAugmentConfig

This class is an implementation of AugmentConfig that applies intensity augmentations.

IntensityScaleShiftAugmentConfig

This class is an implementation of AugmentConfig that applies intensity scaling and shifting.

Package Contents

class dacapo.experiments.trainers.gp_augments.AugmentConfig

Base class for gunpowder augment configurations. Each subclass of a Augment should have a corresponding config class derived from AugmentConfig.

_raw_key

Key for raw data. Not used in this implementation. Defaults to None.

_gt_key

Key for ground truth data. Not used in this implementation. Defaults to None.

_mask_key

Key for mask data. Not used in this implementation. Defaults to None.

node(_raw_key=None, _gt_key=None, _mask_key=None)

Get a gp.Augment node.

abstract node(raw_key: gunpowder.ArrayKey, gt_key: gunpowder.ArrayKey, mask_key: gunpowder.ArrayKey) gunpowder.BatchFilter

Get a gunpowder augment node.

Parameters:
  • raw_key (gp.ArrayKey) – Key for raw data.

  • gt_key (gp.ArrayKey) – Key for ground truth data.

  • mask_key (gp.ArrayKey) – Key for mask data.

Returns:

Augmentation node which can be incorporated in the pipeline.

Return type:

gunpowder.BatchFilter

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> node = augment_config.node(raw_key, gt_key, mask_key)
class dacapo.experiments.trainers.gp_augments.ElasticAugmentConfig

A class that holds the configuration details for the elastic augmentations.

control_point_spacing

Distance(in voxels per dimension) between control points for the elastic deformation.

Type:

List[int]

control_point_displacement_sigma

Standard deviation of control point displacement distribution, in world coordinates.

Type:

List[float]

rotation_interval

An interval to randomly sample rotation angles from (0,2PI).

Type:

Tuple[float, float]

subsample

Downsample factor to perform the elastic augmentation on a grid. Default is 1.

Type:

int

uniform_3d_rotation

Should 3D rotations be performed uniformly. The ‘rotation_interval’ will be ignored. Default is False.

Type:

bool

node(_raw_key=None, _gt_key=None, _mask_key=None)

Returns the object of ElasticAugment with the given configuration details.

control_point_spacing: List[int]
control_point_displacement_sigma: List[float]
rotation_interval: Tuple[float, float]
subsample: int
uniform_3d_rotation: bool
node(_raw_key=None, _gt_key=None, _mask_key=None)

Returns the object of ElasticAugment with the given configuration details.

Parameters:
  • _raw_key – Unused variable, kept for future use.

  • _gt_key – Unused variable, kept for future use.

  • _mask_key – Unused variable, kept for future use.

Returns:

A ElasticAugment object configured with control_point_spacing,

control_point_displacement_sigma, rotation_interval, subsample and uniform_3d_rotation.

Return type:

ElasticAugment

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> node = elastic_augment_config.node()
class dacapo.experiments.trainers.gp_augments.SimpleAugmentConfig

This class is an implementation of AugmentConfig that applies simple augmentations.

Parameters:
  • _raw_key – Key for raw data. Not used in this implementation. Defaults to None.

  • _gt_key – Key for ground truth data. Not used in this implementation. Defaults to None.

  • _mask_key – Key for mask data. Not used in this implementation. Defaults to None.

node(_raw_key=None, _gt_key=None, _mask_key=None)

Get a gp.SimpleAugment node.

Note

This class is a subclass of AugmentConfig.

node(_raw_key=None, _gt_key=None, _mask_key=None)

Get a gp.SimpleAugment node.

Parameters:
  • _raw_key ([type], optional) – Specific key for raw data, not used in this implementation. Defaults to None.

  • _gt_key ([type], optional) – Specific key for ground truth data, not used in this implementation. Defaults to None.

  • _mask_key ([type], optional) – Specific key for mask data, not used in this implementation. Defaults to None.

Returns:

Simple augmentation node which can be incorporated in the pipeline.

Return type:

gunpowder.SimpleAugment

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> node = simple_augment_config.node()
class dacapo.experiments.trainers.gp_augments.GammaAugmentConfig

This class manages the configuration of gamma augmentation for a given dataset.

gamma_range

A tuple of float values represents the min and max range of gamma noise

to apply on the raw data.
node()

Constructs a node in the augmentation pipeline.

gamma_range: Tuple[float, float]
node(raw_key: gunpowder.ArrayKey, _gt_key=None, _mask_key=None)

Constructs a node in the augmentation pipeline.

Parameters:
  • raw_key (gp.ArrayKey) – Key to an Array (volume) in the pipeline

  • _gt_key (gp.ArrayKey, optional) – Ground Truth key, not used in this function. Defaults to None.

  • _mask_key (gp.ArrayKey, optional) – Mask Key, not used in this function. Defaults to None.

Returns:

The augmentation method to be applied on the source data.

Return type:

GammaAugment instance

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> node = gamma_augment_config.node(raw_key)
class dacapo.experiments.trainers.gp_augments.IntensityAugmentConfig

This class is an implementation of AugmentConfig that applies intensity augmentations.

scale

A range within which to choose a random scale factor.

Type:

Tuple[float, float]

shift

A range within which to choose a random additive shift.

Type:

Tuple[float, float]

clip

Set to False if modified values should not be clipped to [0, 1]

Type:

bool

node(raw_key, _gt_key=None, _mask_key=None)

Get a gp.IntensityAugment node.

scale: Tuple[float, float]
shift: Tuple[float, float]
clip: bool
node(raw_key: gunpowder.ArrayKey, _gt_key=None, _mask_key=None)

Get a gp.IntensityAugment node.

Parameters:
  • raw_key (gp.ArrayKey) – Key for raw data.

  • _gt_key ([type], optional) – Specific key for ground truth data, not used in this implementation. Defaults to None.

  • _mask_key ([type], optional) – Specific key for mask data, not used in this implementation. Defaults to None.

Returns:

Intensity augmentation node which can be incorporated in the pipeline.

Return type:

gunpowder.IntensityAugment

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> node = intensity_augment_config.node(raw_key)
class dacapo.experiments.trainers.gp_augments.IntensityScaleShiftAugmentConfig

This class is an implementation of AugmentConfig that applies intensity scaling and shifting.

scale

A constant to scale your intensities.

Type:

float

shift

A constant to shift your intensities.

Type:

float

node(raw_key, _gt_key=None, _mask_key=None)

Get a gp.IntensityScaleShift node.

Note

This class is a subclass of AugmentConfig.

scale: float
shift: float
node(raw_key: gunpowder.ArrayKey, _gt_key=None, _mask_key=None)

Get a gp.IntensityScaleShift node.

Parameters:
  • raw_key (gp.ArrayKey) – Key for raw data.

  • _gt_key ([type], optional) – Specific key for ground truth data, not used in this implementation. Defaults to None.

  • _mask_key ([type], optional) – Specific key for mask data, not used in this implementation. Defaults to None.

Returns:

Intensity scaling and shifting node which can be incorporated in the pipeline.

Return type:

gunpowder.IntensityScaleShift

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> node = intensity_scale_shift_augment_config.node(raw_key)