Class BaseImagePreProcessor

java.lang.Object
ai.djl.modality.cv.translator.BaseImageTranslator<Void>
ai.djl.modality.cv.translator.BaseImagePreProcessor
All Implemented Interfaces:
PostProcessor<Void>, PreProcessor<Image>, Translator<Image,Void>

public class BaseImagePreProcessor extends BaseImageTranslator<Void>
A BaseImageTranslator that only handles pre-processing inputs.
  • Constructor Details

    • BaseImagePreProcessor

      public BaseImagePreProcessor(BaseImageTranslator.BaseBuilder<?> builder)
      Constructs an ImageTranslator with the provided builder.
      Parameters:
      builder - the data to build with
  • Method Details

    • processOutput

      public Void 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
    • processInput

      public NDList processInput(TranslatorContext ctx, Image input)
      Processes the input and converts it to NDList.
      Specified by:
      processInput in interface PreProcessor<Image>
      Overrides:
      processInput in class BaseImageTranslator<Void>
      Parameters:
      ctx - the toolkit for creating the input NDArray
      input - the input object
      Returns:
      the NDList after pre-processing