Package ai.djl.modality.cv.translator
Class SemanticSegmentationTranslator
java.lang.Object
ai.djl.modality.cv.translator.BaseImageTranslator<CategoryMask>
ai.djl.modality.cv.translator.SemanticSegmentationTranslator
- All Implemented Interfaces:
PostProcessor<CategoryMask>
,PreProcessor<Image>
,Translator<Image,
CategoryMask>
A
Translator
that post-process the Image
into CategoryMask
with output
mask representing the class that each pixel in the original image belong to.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The builder for Semantic Segmentation translator.Nested classes/interfaces inherited from class ai.djl.modality.cv.translator.BaseImageTranslator
BaseImageTranslator.BaseBuilder<T extends BaseImageTranslator.BaseBuilder>, BaseImageTranslator.ClassificationBuilder<T extends BaseImageTranslator.BaseBuilder>, BaseImageTranslator.SynsetLoader
-
Field Summary
Fields inherited from class ai.djl.modality.cv.translator.BaseImageTranslator
height, pipeline, width
-
Constructor Summary
ConstructorsConstructorDescriptionCreates the Semantic Segmentation translator from the given builder. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder to build aSemanticSegmentationTranslator
.Creates a builder to build aSemanticSegmentationTranslator
with specified arguments.void
prepare
(TranslatorContext ctx) Prepares the translator with the manager and model to use.processInput
(TranslatorContext ctx, Image image) Processes the input and converts it to NDList.processOutput
(TranslatorContext ctx, NDList list) Processes the output NDList to the corresponding output object.Methods inherited from class ai.djl.modality.cv.translator.BaseImageTranslator
getBatchifier
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ai.djl.translate.Translator
batchProcessInput, batchProcessOutput, getExpansions
-
Constructor Details
-
SemanticSegmentationTranslator
Creates the Semantic Segmentation translator from the given builder.- Parameters:
builder
- the builder for the translator
-
-
Method Details
-
prepare
Prepares the translator with the manager and model to use.- Parameters:
ctx
- the context for thePredictor
.- Throws:
IOException
-
processInput
Processes the input and converts it to NDList.- Specified by:
processInput
in interfacePreProcessor<Image>
- Overrides:
processInput
in classBaseImageTranslator<CategoryMask>
- Parameters:
ctx
- the toolkit for creating the input NDArrayimage
- the input object- Returns:
- the
NDList
after pre-processing
-
processOutput
Processes the output NDList to the corresponding output object.- Parameters:
ctx
- the toolkit used for post-processinglist
- the output NDList after inference, usually immutable in engines like PyTorch. @see Issue 1774- Returns:
- the output object of expected type
-
builder
Creates a builder to build aSemanticSegmentationTranslator
.- Returns:
- a new builder
-
builder
Creates a builder to build aSemanticSegmentationTranslator
with specified arguments.- Parameters:
arguments
- arguments to specify builder options- Returns:
- a new builder
-