dacapo.experiments.tasks

Subpackages

Submodules

Package Contents

Classes

Task

Helper class that provides a standard way to create an ABC using

TaskConfig

Base class for task configurations. Each subclass of a Task should

DummyTaskConfig

A class for creating a dummy task configuration object.

DummyTask

A dummy task class that initializes all components (predictor, loss,

DistanceTaskConfig

This is a Distance task config used for generating and

DistanceTask

DistanceTask is a subclass of Task for handling tasks associated

OneHotTaskConfig

Class that derives from the TaskConfig to perform one hot prediction tasks.

OneHotTask

Helper class that provides a standard way to create an ABC using

PretrainedTaskConfig

PretrainedTask

Helper class that provides a standard way to create an ABC using

AffinitiesTaskConfig

This is a Affinities task config used for generating and

AffinitiesTask

This is a task for generating voxel affinities.

InnerDistanceTaskConfig

This is a Distance task config used for generating and

InnerDistanceTask

This class extends the Task class for creating tasks related to computing inner distances.

HotDistanceTaskConfig

Class for generating TaskConfigs for the HotDistanceTask, which predicts one hot encodings of classes, as well as signed distance transforms of those classes.

HotDistanceTask

A class to represent a hot distance task that use binary prediction and distance prediction.

class dacapo.experiments.tasks.Task

Helper class that provides a standard way to create an ABC using inheritance.

property parameters: Iterable[dacapo.experiments.tasks.post_processors.PostProcessorParameters]
property evaluation_scores: dacapo.experiments.tasks.evaluators.EvaluationScores
predictor: dacapo.experiments.tasks.predictors.Predictor
loss: dacapo.experiments.tasks.losses.Loss
evaluator: dacapo.experiments.tasks.evaluators.Evaluator
post_processor: dacapo.experiments.tasks.post_processors.PostProcessor
create_model(architecture)
class dacapo.experiments.tasks.TaskConfig

Base class for task configurations. Each subclass of a Task should have a corresponding config class derived from TaskConfig.

name: str
verify() Tuple[bool, str]

Check whether this is a valid Task

class dacapo.experiments.tasks.DummyTaskConfig

A class for creating a dummy task configuration object.

This class extends the TaskConfig class and initializes dummy task configuration with default attributes. It is mainly used for testing aspects of the application without the need of creating real task configurations.

task_type

The type of task. Here, set to DummyTask.

Type:

cls

embedding_dims

A dummy attribute represented as an integer.

Type:

int

detection_threshold

Another dummy attribute represented as a float.

Type:

float

task_type
embedding_dims: int
detection_threshold: float
verify() Tuple[bool, str]

A method to verify the dummy task configuration.

Whenever called, this method always returns False and a statement showing that the DummyTaskConfig object is never valid.

Returns:

A tuple containing a boolean status and a string message.

Return type:

tuple

class dacapo.experiments.tasks.DummyTask(task_config)

A dummy task class that initializes all components (predictor, loss, post-processing, and evaluator) for the dummy task. Primarily used for testing purposes. Inherits from the Task class.

predictor

Instance of DummyPredictor class.

Type:

Object

loss

Instance of DummyLoss class.

Type:

Object

post_processor

Instance of DummyPostProcessor class.

Type:

Object

evaluator

Instance of DummyEvaluator class.

Type:

Object

class dacapo.experiments.tasks.DistanceTaskConfig

This is a Distance task config used for generating and evaluating signed distance transforms as a way of generating segmentations.

The advantage of generating distance transforms over regular affinities is you can get a denser signal, i.e. 1 misclassified pixel in an affinity prediction could merge 2 otherwise very distinct objects, this cannot happen with distances.

task_type
channels: List[str]
clip_distance: float
tol_distance: float
scale_factor: float
mask_distances: bool
clipmin: float
clipmax: float
class dacapo.experiments.tasks.DistanceTask(task_config)

DistanceTask is a subclass of Task for handling tasks associated with Distance.

DistanceTask uses DistancePredictor for prediction, MSELoss for computing loss, ThresholdPostProcessor for post-processing the prediction, and BinarySegmentationEvaluator for evaluating the prediction.

predictor

DistancePredictor object

loss

MSELoss object

post_processor

ThresholdPostProcessor object

evaluator

BinarySegmentationEvaluator object

class dacapo.experiments.tasks.OneHotTaskConfig

Class that derives from the TaskConfig to perform one hot prediction tasks.

task_type

the type of task, in this case, OneHotTask.

classes

a List of classes which starts from id 0.

None()

Note

The class of each voxel is simply the argmax over the vector of output probabilities.

task_type
classes: List[str]
class dacapo.experiments.tasks.OneHotTask(task_config)

Helper class that provides a standard way to create an ABC using inheritance.

class dacapo.experiments.tasks.PretrainedTaskConfig
task_type
sub_task_config: dacapo.experiments.tasks.task_config.TaskConfig
weights: pathlib.Path
class dacapo.experiments.tasks.PretrainedTask(task_config)

Helper class that provides a standard way to create an ABC using inheritance.

create_model(architecture)
class dacapo.experiments.tasks.AffinitiesTaskConfig

This is a Affinities task config used for generating and evaluating voxel affinities for instance segmentations.

task_type
neighborhood: List[funlib.geometry.Coordinate]
lsds: bool
lsds_to_affs_weight_ratio: float
affs_weight_clipmin: float
affs_weight_clipmax: float
lsd_weight_clipmin: float
lsd_weight_clipmax: float
background_as_object: bool
class dacapo.experiments.tasks.AffinitiesTask(task_config)

This is a task for generating voxel affinities.

class dacapo.experiments.tasks.InnerDistanceTaskConfig

This is a Distance task config used for generating and evaluating signed distance transforms as a way of generating segmentations.

The advantage of generating distance transforms over regular affinities is you can get a denser signal, i.e. 1 misclassified pixel in an affinity prediction could merge 2 otherwise very distinct objects, this cannot happen with distances.

task_type
channels: List[str]
clip_distance: float
tol_distance: float
scale_factor: float
class dacapo.experiments.tasks.InnerDistanceTask(task_config)

This class extends the Task class for creating tasks related to computing inner distances. It provides methods for prediction, loss calculation and post-processing. It includes Binary Segmentation Evaluator for evaluation.

task_config

The configuration for the task.

predictor

Used for predicting the inner distances.

loss

Used for calculating the mean square error loss.

post_processor

Used for applying threshold post-processing.

evaluator

Used for evaluating the results using binary segmentation.

class dacapo.experiments.tasks.HotDistanceTaskConfig

Class for generating TaskConfigs for the HotDistanceTask, which predicts one hot encodings of classes, as well as signed distance transforms of those classes.

task_type

A reference to the Hot Distance Task class.

channels

A list of channel names.

Type:

List[str]

clip_distance

Maximum distance to consider for false positive/negatives.

Type:

float

tol_distance

Tolerance distance for counting false positives/negatives.

Type:

float

scale_factor

The amount by which to scale distances before applying a tanh normalization. Defaults to 1.

Type:

float

mask_distances

Whether or not to mask out regions where the true distance to object boundary cannot be known. Defaults to False

Type:

bool

Note

Generating distance transforms over regular affinities provides you with a denser signal, i.e., one misclassified pixel in an affinity prediction can merge 2 otherwise very distinct objects, a situation that cannot happen with distances.

task_type
channels: List[str]
clip_distance: float
tol_distance: float
scale_factor: float
mask_distances: bool
class dacapo.experiments.tasks.HotDistanceTask(task_config)

A class to represent a hot distance task that use binary prediction and distance prediction.

Inherits from Task class.

predictor

HotDistancePredictor object.

loss

HotDistanceLoss object.

post_processor

ThresholdPostProcessor object.

evaluator

BinarySegmentationEvaluator object.