Class SegmentObjectsFromTensorFlowModel
Object
AnchorBean<SegmentStackIntoObjectsPooled<OpenCVModel>>
InitializableBean<SegmentStackIntoObjectsPooled<OpenCVModel>,ImageInitialization>
ImageBean<SegmentStackIntoObjectsPooled<OpenCVModel>>
SegmentationBean<SegmentStackIntoObjectsPooled<OpenCVModel>>
SegmentStackIntoObjectsPooled<OpenCVModel>
SegmentStackIntoObjectsScaleDecode<org.opencv.core.Mat,OpenCVModel>
SegmentObjectsFromTensorFlowModel
public class SegmentObjectsFromTensorFlowModel
extends SegmentStackIntoObjectsScaleDecode<org.opencv.core.Mat,OpenCVModel>
Performs instance-segmentation using OpenCV's DNN module and a TensorFlow
.pb
SavedModel file.
Optionally a .pb.txt
file may accompany it.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateModelPool
(ConcurrencyPlan plan, Logger logger) Creates the model pool (to be used by multiple threads).protected org.opencv.core.Mat
deriveInput
(Stack stack, Optional<double[]> subtractMeans) Derives the input tensor from an image.Relative-path to the TensorFlow model file, likely with.pb
extension, relative to the models/ directory in the Anchor distribution.Relative-path to the TensorFlow model file, likely with.pb.txt
extension, relative to the models/ directory in the Anchor distribution.The name of the tensor in the model which the input-image is mapped to.void
setModelBinaryPath
(String modelBinaryPath) Relative-path to the TensorFlow model file, likely with.pb
extension, relative to the models/ directory in the Anchor distribution.void
setModelTextGraphPath
(String modelTextGraphPath) Relative-path to the TensorFlow model file, likely with.pb.txt
extension, relative to the models/ directory in the Anchor distribution.Methods inherited from class org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsScaleDecode
getClassLabelsPath, getDecode, getDisplayer, getInterpolator, getScaleInput, getSubtractMean, segment, setClassLabelsPath, setDecode, setDisplayer, setInterpolator, setScaleInput, setSubtractMean
Methods inherited from class org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsPooled
resolve, segment
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
-
SegmentObjectsFromTensorFlowModel
public SegmentObjectsFromTensorFlowModel()
-
-
Method Details
-
createModelPool
public ConcurrentModelPool<OpenCVModel> createModelPool(ConcurrencyPlan plan, Logger logger) throws CreateModelFailedException Description copied from class:SegmentStackIntoObjectsPooled
Creates the model pool (to be used by multiple threads).- Specified by:
createModelPool
in classSegmentStackIntoObjectsPooled<OpenCVModel>
- 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.
-
deriveInput
protected org.opencv.core.Mat deriveInput(Stack stack, Optional<double[]> subtractMeans) throws OperationFailedException Description copied from class:SegmentStackIntoObjectsScaleDecode
Derives the input tensor from an image.- Specified by:
deriveInput
in classSegmentStackIntoObjectsScaleDecode<org.opencv.core.Mat,
OpenCVModel> - Parameters:
stack
- the image which is mapped into an input tensor.subtractMeans
- respective intensity values that are subtracted from the voxels before being added to the tensor (respectively for each channel).- Returns:
- the tensor, representing the input image.
- Throws:
OperationFailedException
- if an input tensor cannot be created.
-
inputName
Description copied from class:SegmentStackIntoObjectsScaleDecode
The name of the tensor in the model which the input-image is mapped to.- Specified by:
inputName
in classSegmentStackIntoObjectsScaleDecode<org.opencv.core.Mat,
OpenCVModel> - Returns:
- the name.
-
getModelBinaryPath
Relative-path to the TensorFlow model file, likely with.pb
extension, relative to the models/ directory in the Anchor distribution. -
setModelBinaryPath
Relative-path to the TensorFlow model file, likely with.pb
extension, relative to the models/ directory in the Anchor distribution. -
getModelTextGraphPath
Relative-path to the TensorFlow model file, likely with.pb.txt
extension, relative to the models/ directory in the Anchor distribution.If empty, then no such file is specified.
-
setModelTextGraphPath
Relative-path to the TensorFlow model file, likely with.pb.txt
extension, relative to the models/ directory in the Anchor distribution.If empty, then no such file is specified.
-