Package ai.djl.modality.cv.translator
Class YoloV5Translator
java.lang.Object
ai.djl.modality.cv.translator.BaseImageTranslator<DetectedObjects>
ai.djl.modality.cv.translator.ObjectDetectionTranslator
ai.djl.modality.cv.translator.YoloV5Translator
- All Implemented Interfaces:
PostProcessor<DetectedObjects>,PreProcessor<Image>,Translator<Image,DetectedObjects>
- Direct Known Subclasses:
YoloSegmentationTranslator,YoloV8Translator
A translator for YoloV5 models. This was tested with ONNX exported Yolo models. For details check
here
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe builder forYoloV5Translator.static enumA enum represents the Yolo output type.Nested classes/interfaces inherited from class ai.djl.modality.cv.translator.ObjectDetectionTranslator
ObjectDetectionTranslator.ObjectDetectionBuilder<T extends ObjectDetectionTranslator.ObjectDetectionBuilder>Nested classes/interfaces inherited from class ai.djl.modality.cv.translator.BaseImageTranslator
BaseImageTranslator.BaseBuilder<T extends BaseImageTranslator.BaseBuilder>, BaseImageTranslator.ClassificationBuilder<T extends BaseImageTranslator.BaseBuilder>, BaseImageTranslator.SynsetLoader -
Field Summary
Fields inherited from class ai.djl.modality.cv.translator.ObjectDetectionTranslator
applyRatio, classes, removePadding, thresholdFields inherited from class ai.djl.modality.cv.translator.BaseImageTranslator
height, pipeline, width -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedYoloV5Translator(YoloV5Translator.Builder builder) Constructs an ImageTranslator with the provided builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic YoloV5Translator.Builderbuilder()Creates a builder to build aYoloV5Translator.static YoloV5Translator.BuilderCreates a builder to build aYoloV5Translatorwith specified arguments.protected DetectedObjectsnms(int imageWidth, int imageHeight, List<Rectangle> boxes, List<Integer> classIds, List<Float> scores) protected DetectedObjectsprocessFromBoxOutput(int imageWidth, int imageHeight, NDList list) processOutput(TranslatorContext ctx, NDList list) Processes the output NDList to the corresponding output object.Methods inherited from class ai.djl.modality.cv.translator.ObjectDetectionTranslator
prepareMethods inherited from class ai.djl.modality.cv.translator.BaseImageTranslator
getBatchifier, processInputMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.djl.translate.Translator
batchProcessInput, batchProcessOutput, getExpansions
-
Constructor Details
-
YoloV5Translator
Constructs an ImageTranslator with the provided builder.- Parameters:
builder- the data to build with
-
-
Method Details
-
builder
Creates a builder to build aYoloV5Translator.- Returns:
- a new builder
-
builder
Creates a builder to build aYoloV5Translatorwith specified arguments.- Parameters:
arguments- arguments to specify builder options- Returns:
- a new builder
-
nms
-
processFromBoxOutput
-
processOutput
Processes the output NDList to the corresponding output object.- 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
-