dacapo.experiments.tasks.predictors
Submodules
dacapo.experiments.tasks.predictors.affinities_predictordacapo.experiments.tasks.predictors.distance_predictordacapo.experiments.tasks.predictors.dummy_predictordacapo.experiments.tasks.predictors.hot_distance_predictordacapo.experiments.tasks.predictors.inner_distance_predictordacapo.experiments.tasks.predictors.one_hot_predictordacapo.experiments.tasks.predictors.predictor
Package Contents
Classes
Helper class that provides a standard way to create an ABC using |
|
Predict signed distances for a binary segmentation task. |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Predict signed distances for a binary segmentation task. |
|
Predict signed distances and one hot embedding (as a proxy task) for a binary segmentation task. |
- class dacapo.experiments.tasks.predictors.DummyPredictor(embedding_dims)
Helper class that provides a standard way to create an ABC using inheritance.
- property output_array_type
- create_model(architecture)
Given a training architecture, create a model for this predictor. This is usually done by appending extra layers to the output of the architecture to get the output tensor of the architecture into the right shape for this predictor.
- create_target(gt)
Create the target array for training, given a ground-truth array.
In general, the target is different from the ground-truth.
The target is the array that is passed to the loss, and hence directly compared to the prediction (i.e., the output of the model). Depending on the predictor, the target can therefore be different from the ground-truth (e.g., an instance segmentation ground-truth would have to be converted into boundaries, if the model is predicting boundaries).
By default, it is assumed that the spatial dimensions of ground-truth and target are the same.
If your predictor needs more ground-truth context to create a target (e.g., because it predicts the distance to a boundary, up to a certain threshold), you can request a larger ground-truth region. See method
gt_region_for_roi.
- create_weight(gt, target, mask, moving_class_counts=None)
Create the weight array for training, given a ground-truth and associated target array.
- class dacapo.experiments.tasks.predictors.DistancePredictor(channels: List[str], scale_factor: float, mask_distances: bool, clipmin: float = 0.05, clipmax: float = 0.95)
Predict signed distances for a binary segmentation task. Distances deep within background are pushed to -inf, distances deep within the foreground object are pushed to inf. After distances have been calculated they are passed through a tanh so that distances saturate at +-1. Multiple classes can be predicted via multiple distance channels. The names of each class that is being segmented can be passed in as a list of strings in the channels argument.
- property embedding_dims
- property output_array_type
- create_model(architecture)
Given a training architecture, create a model for this predictor. This is usually done by appending extra layers to the output of the architecture to get the output tensor of the architecture into the right shape for this predictor.
- create_target(gt)
Create the target array for training, given a ground-truth array.
In general, the target is different from the ground-truth.
The target is the array that is passed to the loss, and hence directly compared to the prediction (i.e., the output of the model). Depending on the predictor, the target can therefore be different from the ground-truth (e.g., an instance segmentation ground-truth would have to be converted into boundaries, if the model is predicting boundaries).
By default, it is assumed that the spatial dimensions of ground-truth and target are the same.
If your predictor needs more ground-truth context to create a target (e.g., because it predicts the distance to a boundary, up to a certain threshold), you can request a larger ground-truth region. See method
gt_region_for_roi.
- create_weight(gt, target, mask, moving_class_counts=None)
Create the weight array for training, given a ground-truth and associated target array.
- create_distance_mask(distances: numpy.ndarray, mask: numpy.ndarray, voxel_size: funlib.geometry.Coordinate, normalize=None, normalize_args=None)
- process(labels: numpy.ndarray, voxel_size: funlib.geometry.Coordinate, normalize=None, normalize_args=None)
- gt_region_for_roi(target_spec)
Report how much spatial context this predictor needs to generate a target for the given ROI. By default, uses the same ROI.
Overwrite this method to request ground-truth in a larger ROI, as needed.
- padding(gt_voxel_size: funlib.geometry.Coordinate) funlib.geometry.Coordinate
- class dacapo.experiments.tasks.predictors.OneHotPredictor(classes: List[str])
Helper class that provides a standard way to create an ABC using inheritance.
- property embedding_dims
- property output_array_type
- create_model(architecture)
Given a training architecture, create a model for this predictor. This is usually done by appending extra layers to the output of the architecture to get the output tensor of the architecture into the right shape for this predictor.
- create_target(gt)
Create the target array for training, given a ground-truth array.
In general, the target is different from the ground-truth.
The target is the array that is passed to the loss, and hence directly compared to the prediction (i.e., the output of the model). Depending on the predictor, the target can therefore be different from the ground-truth (e.g., an instance segmentation ground-truth would have to be converted into boundaries, if the model is predicting boundaries).
By default, it is assumed that the spatial dimensions of ground-truth and target are the same.
If your predictor needs more ground-truth context to create a target (e.g., because it predicts the distance to a boundary, up to a certain threshold), you can request a larger ground-truth region. See method
gt_region_for_roi.
- create_weight(gt, target, mask, moving_class_counts=None)
Create the weight array for training, given a ground-truth and associated target array.
- process(labels: numpy.ndarray)
- class dacapo.experiments.tasks.predictors.Predictor
Helper class that provides a standard way to create an ABC using inheritance.
- abstract property output_array_type
- abstract create_model(architecture: dacapo.experiments.architectures.architecture.Architecture) dacapo.experiments.model.Model
Given a training architecture, create a model for this predictor. This is usually done by appending extra layers to the output of the architecture to get the output tensor of the architecture into the right shape for this predictor.
- abstract create_target(gt: dacapo.experiments.datasplits.datasets.arrays.Array) dacapo.experiments.datasplits.datasets.arrays.Array
Create the target array for training, given a ground-truth array.
In general, the target is different from the ground-truth.
The target is the array that is passed to the loss, and hence directly compared to the prediction (i.e., the output of the model). Depending on the predictor, the target can therefore be different from the ground-truth (e.g., an instance segmentation ground-truth would have to be converted into boundaries, if the model is predicting boundaries).
By default, it is assumed that the spatial dimensions of ground-truth and target are the same.
If your predictor needs more ground-truth context to create a target (e.g., because it predicts the distance to a boundary, up to a certain threshold), you can request a larger ground-truth region. See method
gt_region_for_roi.
- abstract create_weight(gt: dacapo.experiments.datasplits.datasets.arrays.Array, target: dacapo.experiments.datasplits.datasets.arrays.Array, mask: dacapo.experiments.datasplits.datasets.arrays.Array, moving_class_counts: Any) Tuple[dacapo.experiments.datasplits.datasets.arrays.Array, Any]
Create the weight array for training, given a ground-truth and associated target array.
- gt_region_for_roi(target_spec)
Report how much spatial context this predictor needs to generate a target for the given ROI. By default, uses the same ROI.
Overwrite this method to request ground-truth in a larger ROI, as needed.
- padding(gt_voxel_size: funlib.geometry.Coordinate) funlib.geometry.Coordinate
- class dacapo.experiments.tasks.predictors.AffinitiesPredictor(neighborhood: List[funlib.geometry.Coordinate], lsds: bool = True, num_voxels: int = 20, downsample_lsds: int = 1, grow_boundary_iterations: int = 0, affs_weight_clipmin: float = 0.05, affs_weight_clipmax: float = 0.95, lsd_weight_clipmin: float = 0.05, lsd_weight_clipmax: float = 0.95, background_as_object: bool = False)
Helper class that provides a standard way to create an ABC using inheritance.
- property dims
- property num_channels
- property output_array_type
- extractor(voxel_size)
- sigma(voxel_size)
- lsd_pad(voxel_size)
- create_model(architecture)
Given a training architecture, create a model for this predictor. This is usually done by appending extra layers to the output of the architecture to get the output tensor of the architecture into the right shape for this predictor.
- create_target(gt)
Create the target array for training, given a ground-truth array.
In general, the target is different from the ground-truth.
The target is the array that is passed to the loss, and hence directly compared to the prediction (i.e., the output of the model). Depending on the predictor, the target can therefore be different from the ground-truth (e.g., an instance segmentation ground-truth would have to be converted into boundaries, if the model is predicting boundaries).
By default, it is assumed that the spatial dimensions of ground-truth and target are the same.
If your predictor needs more ground-truth context to create a target (e.g., because it predicts the distance to a boundary, up to a certain threshold), you can request a larger ground-truth region. See method
gt_region_for_roi.
- create_weight(gt, target, mask, moving_class_counts=None)
Create the weight array for training, given a ground-truth and associated target array.
- gt_region_for_roi(target_spec)
Report how much spatial context this predictor needs to generate a target for the given ROI. By default, uses the same ROI.
Overwrite this method to request ground-truth in a larger ROI, as needed.
- class dacapo.experiments.tasks.predictors.InnerDistancePredictor(channels: List[str], scale_factor: float)
Predict signed distances for a binary segmentation task.
Distances deep within background are pushed to -inf, distances deep within the foreground object are pushed to inf. After distances have been calculated they are passed through a tanh so that distances saturate at +-1. Multiple classes can be predicted via multiple distance channels. The names of each class that is being segmented can be passed in as a list of strings in the channels argument.
- property embedding_dims
- property output_array_type
- create_model(architecture)
Given a training architecture, create a model for this predictor. This is usually done by appending extra layers to the output of the architecture to get the output tensor of the architecture into the right shape for this predictor.
- create_target(gt)
Create the target array for training, given a ground-truth array.
In general, the target is different from the ground-truth.
The target is the array that is passed to the loss, and hence directly compared to the prediction (i.e., the output of the model). Depending on the predictor, the target can therefore be different from the ground-truth (e.g., an instance segmentation ground-truth would have to be converted into boundaries, if the model is predicting boundaries).
By default, it is assumed that the spatial dimensions of ground-truth and target are the same.
If your predictor needs more ground-truth context to create a target (e.g., because it predicts the distance to a boundary, up to a certain threshold), you can request a larger ground-truth region. See method
gt_region_for_roi.
- create_weight(gt, target, mask, moving_class_counts=None)
Create the weight array for training, given a ground-truth and associated target array.
- process(labels: numpy.ndarray, voxel_size: funlib.geometry.Coordinate, normalize=None, normalize_args=None)
- gt_region_for_roi(target_spec)
Report how much spatial context this predictor needs to generate a target for the given ROI. By default, uses the same ROI.
Overwrite this method to request ground-truth in a larger ROI, as needed.
- padding(gt_voxel_size: funlib.geometry.Coordinate) funlib.geometry.Coordinate
- class dacapo.experiments.tasks.predictors.HotDistancePredictor(channels: List[str], scale_factor: float, mask_distances: bool)
Predict signed distances and one hot embedding (as a proxy task) for a binary segmentation task. Distances deep within background are pushed to -inf, distances deep within the foreground object are pushed to inf. After distances have been calculated they are passed through a tanh so that distances saturate at +-1. Multiple classes can be predicted via multiple distance channels. The names of each class that is being segmented can be passed in as a list of strings in the channels argument.
- property embedding_dims
- property classes
- property output_array_type
- create_model(architecture)
Given a training architecture, create a model for this predictor. This is usually done by appending extra layers to the output of the architecture to get the output tensor of the architecture into the right shape for this predictor.
- create_target(gt)
Create the target array for training, given a ground-truth array.
In general, the target is different from the ground-truth.
The target is the array that is passed to the loss, and hence directly compared to the prediction (i.e., the output of the model). Depending on the predictor, the target can therefore be different from the ground-truth (e.g., an instance segmentation ground-truth would have to be converted into boundaries, if the model is predicting boundaries).
By default, it is assumed that the spatial dimensions of ground-truth and target are the same.
If your predictor needs more ground-truth context to create a target (e.g., because it predicts the distance to a boundary, up to a certain threshold), you can request a larger ground-truth region. See method
gt_region_for_roi.
- create_weight(gt, target, mask, moving_class_counts=None)
Create the weight array for training, given a ground-truth and associated target array.
- create_distance_mask(distances: numpy.ndarray, mask: numpy.ndarray, voxel_size: funlib.geometry.Coordinate, normalize=None, normalize_args=None)
- process(labels: numpy.ndarray, voxel_size: funlib.geometry.Coordinate, normalize=None, normalize_args=None)
- gt_region_for_roi(target_spec)
Report how much spatial context this predictor needs to generate a target for the given ROI. By default, uses the same ROI.
Overwrite this method to request ground-truth in a larger ROI, as needed.
- padding(gt_voxel_size: funlib.geometry.Coordinate) funlib.geometry.Coordinate