dacapo.experiments.tasks.post_processors.argmax_post_processor
Classes
Post-processor that takes the argmax of the input array along the channel |
Module Contents
- class dacapo.experiments.tasks.post_processors.argmax_post_processor.ArgmaxPostProcessor
Post-processor that takes the argmax of the input array along the channel axis. The output is a binary array where the value is 1 if the argmax is greater than the threshold, and 0 otherwise.
- prediction_array
The array containing the model’s prediction.
- enumerate_parameters()
Enumerate all possible parameters of this post-processor.
- set_prediction()
Set the prediction array identifier.
- process()
Convert predictions into the final output.
Note
This class is abstract. Subclasses must implement the abstract methods. Once created, the values of its attributes cannot be changed.
- enumerate_parameters()
Enumerate all possible parameters of this post-processor. Should return instances of
PostProcessorParameters
.- Returns:
An iterable of PostProcessorParameters instances.
- Raises:
NotImplementedError – If the method is not implemented in the subclass.
Examples
>>> post_processor = ArgmaxPostProcessor() >>> for parameters in post_processor.enumerate_parameters(): ... print(parameters) ArgmaxPostProcessorParameters(id=0)
Note
This method must be implemented in the subclass. It should return an iterable of PostProcessorParameters instances.
- set_prediction(prediction_array_identifier)
Set the prediction array identifier.
- Parameters:
prediction_array_identifier – The identifier of the array containing the model’s prediction.
- Raises:
NotImplementedError – If the method is not implemented in the subclass.
Examples
>>> post_processor = ArgmaxPostProcessor() >>> post_processor.set_prediction("prediction")
Note
This method must be implemented in the subclass. It should set the prediction_array_identifier attribute.
- process(parameters, output_array_identifier: dacapo.store.array_store.LocalArrayIdentifier, num_workers: int = 16, block_size: daisy.Coordinate = Coordinate((256, 256, 256)))
Convert predictions into the final output.
- Parameters:
parameters – The parameters of the post-processor.
output_array_identifier – The identifier of the output array.
num_workers – The number of workers to use.
block_size – The size of the blocks to process.
- Returns:
The output array.
- Raises:
NotImplementedError – If the method is not implemented in the subclass.
Examples
>>> post_processor = ArgmaxPostProcessor() >>> post_processor.set_prediction("prediction") >>> post_processor.process(parameters, "output")
Note
This method must be implemented in the subclass. It should process the predictions and return the output array.