Package ai.djl.modality.cv.translator
Class BaseImageTranslator<T>
java.lang.Object
ai.djl.modality.cv.translator.BaseImageTranslator<T>
- Type Parameters:
T- the output object type
- All Implemented Interfaces:
PostProcessor<T>,PreProcessor<Image>,Translator<Image,T>
- Direct Known Subclasses:
ImageClassificationTranslator,ImageFeatureExtractor,InstanceSegmentationTranslator,ObjectDetectionTranslator,SemanticSegmentationTranslator,SimplePoseTranslator,YoloPoseTranslator
Built-in
Translator that provides default image pre-processing.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder to extend for all classes extending theBaseImageTranslator.static classA Builder to construct aImageClassificationTranslator.protected static final class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBaseImageTranslator(BaseImageTranslator.BaseBuilder<?> builder) Constructs an ImageTranslator with the provided builder. -
Method Summary
Modifier and TypeMethodDescriptionReturns theBatchifier.processInput(TranslatorContext ctx, Image input) Processes the input and converts it to NDList.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.djl.translate.PostProcessor
processOutputMethods inherited from interface ai.djl.translate.Translator
batchProcessInput, batchProcessOutput, getExpansions, prepare
-
Field Details
-
pipeline
-
width
protected int width -
height
protected int height
-
-
Constructor Details
-
BaseImageTranslator
Constructs an ImageTranslator with the provided builder.- Parameters:
builder- the data to build with
-
-
Method Details
-
getBatchifier
Returns theBatchifier.- Specified by:
getBatchifierin interfaceTranslator<Image,T> - Returns:
- the
Batchifier
-
processInput
Processes the input and converts it to NDList.- Specified by:
processInputin interfacePreProcessor<T>- Parameters:
ctx- the toolkit for creating the input NDArrayinput- the input object- Returns:
- the
NDListafter pre-processing
-