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>

public class SemanticSegmentationTranslator extends BaseImageTranslator<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.
  • Constructor Details

    • SemanticSegmentationTranslator

      public SemanticSegmentationTranslator(SemanticSegmentationTranslator.Builder builder)
      Creates the Semantic Segmentation translator from the given builder.
      Parameters:
      builder - the builder for the translator
  • Method Details

    • prepare

      public void prepare(TranslatorContext ctx) throws IOException
      Prepares the translator with the manager and model to use.
      Parameters:
      ctx - the context for the Predictor.
      Throws:
      IOException
    • processOutput

      public CategoryMask processOutput(TranslatorContext ctx, NDList list)
      Processes the output NDList to the corresponding output object.
      Parameters:
      ctx - the toolkit used for post-processing
      list - the output NDList after inference, usually immutable in engines like PyTorch. @see Issue 1774
      Returns:
      the output object of expected type
    • builder

      public static SemanticSegmentationTranslator.Builder builder()
      Creates a builder to build a SemanticSegmentationTranslator.
      Returns:
      a new builder
    • builder

      public static SemanticSegmentationTranslator.Builder builder(Map<String,?> arguments)
      Creates a builder to build a SemanticSegmentationTranslator with specified arguments.
      Parameters:
      arguments - arguments to specify builder options
      Returns:
      a new builder