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
public abstract class BaseImageTranslator<T> extends java.lang.Object implements Translator<Image,T>
Built-inTranslatorthat provides default image pre-processing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBaseImageTranslator.BaseBuilder<T extends BaseImageTranslator.BaseBuilder>A builder to extend for all classes extending theBaseImageTranslator.static classBaseImageTranslator.ClassificationBuilder<T extends BaseImageTranslator.BaseBuilder>A Builder to construct aImageClassificationTranslator.protected static classBaseImageTranslator.SynsetLoader
-
Constructor Summary
Constructors Constructor Description BaseImageTranslator(BaseImageTranslator.BaseBuilder<?> builder)Constructs an ImageTranslator with the provided builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchifiergetBatchifier()Returns theBatchifier.NDListprocessInput(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
getExpansions, prepare, toBatchTranslator, toBatchTranslator
-
-
-
-
Field Detail
-
pipeline
protected Pipeline pipeline
-
-
Constructor Detail
-
BaseImageTranslator
public BaseImageTranslator(BaseImageTranslator.BaseBuilder<?> builder)
Constructs an ImageTranslator with the provided builder.- Parameters:
builder- the data to build with
-
-
Method Detail
-
getBatchifier
public Batchifier getBatchifier()
Returns theBatchifier.- Specified by:
getBatchifierin interfaceTranslator<Image,T>- Returns:
- the
Batchifier
-
processInput
public NDList processInput(TranslatorContext ctx, Image input)
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
-
-