Class SegmentObjectsFromONNXModel
Object
public class SegmentObjectsFromONNXModel
extends SegmentStackIntoObjectsScaleDecode<ai.onnxruntime.OnnxTensor, OnnxModel>
Performs instance-segmentation using the ONNX Runtime and an
.onnx model file.- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConcurrentModelPool<OnnxModel> createModelPool(ConcurrencyPlan plan, Logger logger) protected ai.onnxruntime.OnnxTensorderiveInput(Stack stack, Optional<double[]> subtractMeans) The name of the input in the ONNX model.Relative-path to the model file in ONNX form, relative to the models/ directory in the Anchor distribution.booleanIf true, a 4-dimensional tensor is created (with the first dimension describing a batch-size of 1), instead of the usual 3-dimensional tensor describing channel, height, width.booleanIf true, the channels are placed as the final position of the tensor (**after** width/height) instead of **before** width/height.booleanWhen true, rather than readingmodelPathfrom the file-system, it is read from Java resources on the class-path.voidsetIncludeBatchDimension(boolean includeBatchDimension) If true, a 4-dimensional tensor is created (with the first dimension describing a batch-size of 1), instead of the usual 3-dimensional tensor describing channel, height, width.voidsetInputName(String inputName) The name of the input in the ONNX model.voidsetInterleaveChannels(boolean interleaveChannels) If true, the channels are placed as the final position of the tensor (**after** width/height) instead of **before** width/height.voidsetModelPath(String modelPath) Relative-path to the model file in ONNX form, relative to the models/ directory in the Anchor distribution.voidsetReadFromResources(boolean readFromResources) When true, rather than readingmodelPathfrom the file-system, it is read from Java resources on the class-path.Methods inherited from class org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsScaleDecode
getClassLabelsPath, getDecode, getDisplayer, getInterpolator, getScaleInput, getSubtractMean, segment, setClassLabelsPath, setDecode, setDisplayer, setInterpolator, setScaleInput, setSubtractMeanMethods inherited from class org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsPooled
resolve, segmentMethods 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
-
SegmentObjectsFromONNXModel
public SegmentObjectsFromONNXModel()
-
-
Method Details
-
createModelPool
-
deriveInput
-
inputName
-
getModelPath
Relative-path to the model file in ONNX form, relative to the models/ directory in the Anchor distribution.If
readFromResources==true, it is read instead from resources on the class-path. -
setModelPath
Relative-path to the model file in ONNX form, relative to the models/ directory in the Anchor distribution.If
readFromResources==true, it is read instead from resources on the class-path. -
isReadFromResources
public boolean isReadFromResources()When true, rather than readingmodelPathfrom the file-system, it is read from Java resources on the class-path. -
setReadFromResources
public void setReadFromResources(boolean readFromResources) When true, rather than readingmodelPathfrom the file-system, it is read from Java resources on the class-path. -
getInputName
The name of the input in the ONNX model. -
setInputName
The name of the input in the ONNX model. -
isIncludeBatchDimension
public boolean isIncludeBatchDimension()If true, a 4-dimensional tensor is created (with the first dimension describing a batch-size of 1), instead of the usual 3-dimensional tensor describing channel, height, width. -
setIncludeBatchDimension
public void setIncludeBatchDimension(boolean includeBatchDimension) If true, a 4-dimensional tensor is created (with the first dimension describing a batch-size of 1), instead of the usual 3-dimensional tensor describing channel, height, width. -
isInterleaveChannels
public boolean isInterleaveChannels()If true, the channels are placed as the final position of the tensor (**after** width/height) instead of **before** width/height.Consequently, in terms of raw order in a
FloatBuffer, RGB values become interleaved. -
setInterleaveChannels
public void setInterleaveChannels(boolean interleaveChannels) If true, the channels are placed as the final position of the tensor (**after** width/height) instead of **before** width/height.Consequently, in terms of raw order in a
FloatBuffer, RGB values become interleaved.
-