Class SegmentStackIntoObjectsPooled<T extends InferenceModel>
Object
org.anchoranalysis.bean.AnchorBean<B>
org.anchoranalysis.bean.initializable.InitializableBean<T,org.anchoranalysis.image.bean.nonbean.init.ImageInitialization>
org.anchoranalysis.image.bean.ImageBean<T>
org.anchoranalysis.image.bean.segment.SegmentationBean<SegmentStackIntoObjectsPooled<T>>
org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsPooled<T>
- Type Parameters:
T- model-type
- Direct Known Subclasses:
SegmentStackIntoObjectsScaleDecode,SuppressNonMaximum
public abstract class SegmentStackIntoObjectsPooled<T extends InferenceModel> extends org.anchoranalysis.image.bean.segment.SegmentationBean<SegmentStackIntoObjectsPooled<T>>
A base class for algorithms to segment a stack into one or more objects - using a pool of models
These models are typically CNN deep-learning models.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description SegmentStackIntoObjectsPooled() -
Method Summary
Modifier and Type Method Description abstract ConcurrentModelPool<T>createModelPool(ConcurrencyPlan plan, Logger logger)Creates the model pool (to be used by multiple threads).protected Pathresolve(String modelFilename)Resolves a relative filename for a model into a path, relative to the model directory.SegmentedObjectssegment(Stack stack, ExecutionTimeRecorder executionTimeRecorder)Segments individually using a pool of size 1 just for one stack.abstract SegmentedObjectssegment(Stack stack, ConcurrentModelPool<T> modelPool, ExecutionTimeRecorder executionTimeRecorder)Segments a stack to produce an object-collection.Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized, onInitializationMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
SegmentStackIntoObjectsPooled
public SegmentStackIntoObjectsPooled()
-
-
Method Details
-
segment
public SegmentedObjects segment(Stack stack, ExecutionTimeRecorder executionTimeRecorder) throws org.anchoranalysis.image.bean.nonbean.segment.SegmentationFailedExceptionSegments individually using a pool of size 1 just for one stack.See
segment(Stack, ConcurrentModelPool, ExecutionTimeRecorder)for more details.- Parameters:
stack- the stack to segment.executionTimeRecorder- for measuring execution-times of operations.- Returns:
- a collection of objects with corresponding confidence scores.
- Throws:
org.anchoranalysis.image.bean.nonbean.segment.SegmentationFailedException- if anything goes wrong during the segmentation.
-
createModelPool
public abstract ConcurrentModelPool<T> createModelPool(ConcurrencyPlan plan, Logger logger) throws CreateModelFailedExceptionCreates the model pool (to be used by multiple threads).- Parameters:
plan- the number and types of processors available for concurrent execution.logger- the logger.- Returns:
- the newly created model pool.
- Throws:
CreateModelFailedException- if a model cannot be created.
-
segment
public abstract SegmentedObjects segment(Stack stack, ConcurrentModelPool<T> modelPool, ExecutionTimeRecorder executionTimeRecorder) throws org.anchoranalysis.image.bean.nonbean.segment.SegmentationFailedExceptionSegments a stack to produce an object-collection.Any created objects will always exist inside the stack's
Extent.- Parameters:
stack- the stack to segment.modelPool- the pool of model instances which can each be used for inference (in parallel).executionTimeRecorder- measures execution-times of particular operations.- Returns:
- a collection of objects with corresponding confidence scores.
- Throws:
org.anchoranalysis.image.bean.nonbean.segment.SegmentationFailedException- if anything goes wrong during the segmentation.
-
resolve
Resolves a relative filename for a model into a path, relative to the model directory.- Parameters:
modelFilename- the filename for the model (to the model directory).- Returns:
- an absolute path to the model.
- Throws:
InitializeException- if a bean requires initialization, but has not been initialized.
-