Package ai.djl.modality.cv.translator
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>
A
BaseImageTranslator that only handles pre-processing inputs.-
Nested Class Summary
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
ConstructorsConstructorDescriptionBaseImagePreProcessor(BaseImageTranslator.BaseBuilder<?> builder) Constructs anImageTranslatorwith the provided builder. -
Method Summary
Modifier and TypeMethodDescriptionprocessInput(TranslatorContext ctx, Image input) 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, prepare
-
Constructor Details
-
BaseImagePreProcessor
Constructs anImageTranslatorwith the provided builder.- Parameters:
builder- the data to build with
-
-
Method Details
-
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
-
processInput
Processes the input and converts it to NDList.- Specified by:
processInputin interfacePreProcessor<Image>- Overrides:
processInputin classBaseImageTranslator<Void>- Parameters:
ctx- the toolkit for creating the input NDArrayinput- the input object- Returns:
- the
NDListafter pre-processing
-