public class ImageServingTranslator extends java.lang.Object implements Translator<Input,Output>
Constructor and Description |
---|
ImageServingTranslator(Translator<Image,?> translator)
Constructs a new
ImageServingTranslator instance. |
Modifier and Type | Method and Description |
---|---|
Batchifier |
getBatchifier()
Gets the
Batchifier . |
void |
prepare(TranslatorContext ctx)
Prepares the translator with the manager and model to use.
|
NDList |
processInput(TranslatorContext ctx,
Input input)
Processes the input and converts it to NDList.
|
Output |
processOutput(TranslatorContext ctx,
NDList list)
Processes the output NDList to the corresponding output object.
|
public ImageServingTranslator(Translator<Image,?> translator)
ImageServingTranslator
instance.translator
- a Translator
processes Image inputpublic Batchifier getBatchifier()
Batchifier
.getBatchifier
in interface Translator<Input,Output>
Batchifier
public Output processOutput(TranslatorContext ctx, NDList list) throws java.lang.Exception
processOutput
in interface PostProcessor<Output>
ctx
- the toolkit used for post-processinglist
- the output NDList after inferencejava.lang.Exception
- if an error occurs during processing outputpublic NDList processInput(TranslatorContext ctx, Input input) throws java.lang.Exception
processInput
in interface PreProcessor<Input>
ctx
- the toolkit for creating the input NDArrayinput
- the input objectNDList
after pre-processingjava.lang.Exception
- if an error occurs during processing inputpublic void prepare(TranslatorContext ctx) throws java.lang.Exception
prepare
in interface Translator<Input,Output>
ctx
- the context for the Predictor
.java.lang.Exception
- if there is an error for preparing the translator