Package ai.djl.modality.cv.translator
Class YoloWorldTranslator
java.lang.Object
ai.djl.modality.cv.translator.YoloWorldTranslator
- All Implemented Interfaces:
NoBatchifyTranslator<VisionLanguageInput,,DetectedObjects> PostProcessor<DetectedObjects>,PreProcessor<VisionLanguageInput>,Translator<VisionLanguageInput,DetectedObjects>
public class YoloWorldTranslator
extends Object
implements NoBatchifyTranslator<VisionLanguageInput,DetectedObjects>
A translator for Yolo-world models.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic YoloWorldTranslator.Builderbuilder()Creates a builder to build aYoloWorldTranslator.static YoloWorldTranslator.BuilderCreates a builder to build aYoloWorldTranslatorwith specified arguments.voidprepare(TranslatorContext ctx) Prepares the translator with the manager and model to use.processInput(TranslatorContext ctx, VisionLanguageInput input) Processes the input and converts it to NDList.processOutput(TranslatorContext ctx, NDList list) Processes the output NDList to the corresponding output object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.djl.translate.NoBatchifyTranslator
getBatchifierMethods inherited from interface ai.djl.translate.Translator
batchProcessInput, batchProcessOutput, getExpansions
-
Method Details
-
prepare
Prepares the translator with the manager and model to use.- Specified by:
preparein interfaceTranslator<VisionLanguageInput,DetectedObjects> - Parameters:
ctx- the context for thePredictor.- Throws:
Exception- if there is an error for preparing the translator
-
processInput
public NDList processInput(TranslatorContext ctx, VisionLanguageInput input) throws TranslateException Processes the input and converts it to NDList.- Specified by:
processInputin interfacePreProcessor<VisionLanguageInput>- Parameters:
ctx- the toolkit for creating the input NDArrayinput- the input object- Returns:
- the
NDListafter pre-processing - Throws:
TranslateException
-
processOutput
Processes the output NDList to the corresponding output object.- Specified by:
processOutputin interfacePostProcessor<DetectedObjects>- Parameters:
ctx- the toolkit used for post-processinglist- the output NDList after inference, usually immutable in engines like PyTorch. @see Issue 1774- Returns:
- the output object of expected type
-
builder
Creates a builder to build aYoloWorldTranslator.- Returns:
- a new builder
-
builder
Creates a builder to build aYoloWorldTranslatorwith specified arguments.- Parameters:
arguments- arguments to specify builder options- Returns:
- a new builder
-