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 classThe 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 aSemanticSegmentationTranslatorwith specified arguments.voidprepare(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
getBatchifierMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
processInputin interfacePreProcessor<Image>- Overrides:
processInputin classBaseImageTranslator<CategoryMask>- Parameters:
ctx- the toolkit for creating the input NDArrayimage- the input object- Returns:
- the
NDListafter 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 aSemanticSegmentationTranslatorwith specified arguments.- Parameters:
arguments- arguments to specify builder options- Returns:
- a new builder
-