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 class
A builder to extend for all classes extending theBaseImageTranslator
.static class
A 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, wait
Methods inherited from interface ai.djl.translate.PostProcessor
processOutput
Methods 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:
getBatchifier
in interfaceTranslator<Image,
T> - Returns:
- the
Batchifier
-
processInput
Processes the input and converts it to NDList.- Specified by:
processInput
in interfacePreProcessor<T>
- Parameters:
ctx
- the toolkit for creating the input NDArrayinput
- the input object- Returns:
- the
NDList
after pre-processing
-