T
- the output object typepublic class UrlTranslator<T> extends java.lang.Object implements Translator<java.net.URL,T>
Translator
that provides image pre-processing from URL.Constructor and Description |
---|
UrlTranslator(Translator<Image,T> translator)
Creates a
UrlTranslator 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,
java.net.URL input)
Processes the input and converts it to NDList.
|
T |
processOutput(TranslatorContext ctx,
NDList list)
Processes the output NDList to the corresponding output object.
|
public UrlTranslator(Translator<Image,T> translator)
UrlTranslator
instance.translator
- a Translator
that can process imagepublic NDList processInput(TranslatorContext ctx, java.net.URL input) throws java.lang.Exception
processInput
in interface PreProcessor<java.net.URL>
ctx
- the toolkit for creating the input NDArrayinput
- the input objectNDList
after pre-processingjava.lang.Exception
- if an error occurs during processing inputpublic T processOutput(TranslatorContext ctx, NDList list) throws java.lang.Exception
processOutput
in interface PostProcessor<T>
ctx
- the toolkit used for post-processinglist
- the output NDList after inferencejava.lang.Exception
- if an error occurs during processing outputpublic Batchifier getBatchifier()
Batchifier
.getBatchifier
in interface Translator<java.net.URL,T>
Batchifier
public void prepare(TranslatorContext ctx) throws java.lang.Exception
prepare
in interface Translator<java.net.URL,T>
ctx
- the context for the Predictor
.java.lang.Exception
- if there is an error for preparing the translator