Package ai.djl.translate
Interface TranslatorFactory
- All Known Implementing Classes:
BaseImageTranslatorFactory,BigGANTranslatorFactory,DefaultTranslatorFactory,DeferredTranslatorFactory,ExpansionTranslatorFactory,ImageClassificationTranslatorFactory,ImageFeatureExtractorFactory,InstanceSegmentationTranslatorFactory,NoopServingTranslatorFactory,ObjectDetectionTranslatorFactory,Sam2TranslatorFactory,SemanticSegmentationTranslatorFactory,ServingTranslatorFactory,SimplePoseTranslatorFactory,SingleShotDetectionTranslatorFactory,SpeechRecognitionTranslatorFactory,StyleTransferTranslatorFactory,YoloPoseTranslatorFactory,YoloSegmentationTranslatorFactory,YoloTranslatorFactory,YoloV5TranslatorFactory,YoloV8TranslatorFactory
public interface TranslatorFactory
A utility class creates
Translator instances.-
Method Summary
Modifier and TypeMethodDescriptionReturns supported input/output classes.default booleanisSupported(Class<?> input, Class<?> output) Returns if the input/output is supported by theTranslatorFactory.<I,O> Translator<I, O> Returns a new instance of theTranslatorclass.
-
Method Details
-
getSupportedTypes
Returns supported input/output classes.- Returns:
- a set of supported input/output classes
-
isSupported
Returns if the input/output is supported by theTranslatorFactory.- Parameters:
input- the input classoutput- the output class- Returns:
trueif the input/output type is supported
-
newInstance
<I,O> Translator<I,O> newInstance(Class<I> input, Class<O> output, Model model, Map<String, ?> arguments) throws TranslateExceptionReturns a new instance of theTranslatorclass.- Type Parameters:
I- the input data typeO- the output data type- Parameters:
input- the input classoutput- the output classmodel- theModelthat uses theTranslatorarguments- the configurations for a newTranslatorinstance- Returns:
- a new instance of the
Translatorclass - Throws:
TranslateException- if failed to create Translator instance
-