Class SegmentStackIntoObjectsPooled<T extends InferenceModel>
Object
- Type Parameters:
T
- model-type
- Direct Known Subclasses:
SegmentStackIntoObjectsScaleDecode
,SuppressNonMaximum
public abstract class SegmentStackIntoObjectsPooled<T extends InferenceModel>
extends 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 -
Method Summary
Modifier and TypeMethodDescriptionabstract ConcurrentModelPool
<T> createModelPool
(ConcurrencyPlan plan, Logger logger) Creates the model pool (to be used by multiple threads).protected Path
Resolves a relative filename for a model into a path, relative to the model directory.segment
(Stack stack, ExecutionTimeRecorder executionTimeRecorder) Segments individually using a pool of size 1 just for one stack.abstract SegmentedObjects
segment
(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, onInitialization
Methods 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 SegmentationFailedException Segments 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:
SegmentationFailedException
- if anything goes wrong during the segmentation.
-
createModelPool
public abstract ConcurrentModelPool<T> createModelPool(ConcurrencyPlan plan, Logger logger) throws CreateModelFailedException Creates 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 SegmentationFailedException Segments 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:
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.
-