Class YoloV5Translator

All Implemented Interfaces:
PostProcessor<DetectedObjects>, PreProcessor<Image>, Translator<Image,DetectedObjects>
Direct Known Subclasses:
YoloSegmentationTranslator, YoloV8Translator

public class YoloV5Translator extends ObjectDetectionTranslator
A translator for YoloV5 models. This was tested with ONNX exported Yolo models. For details check here
  • Constructor Details

    • YoloV5Translator

      protected YoloV5Translator(YoloV5Translator.Builder builder)
      Constructs an ImageTranslator with the provided builder.
      Parameters:
      builder - the data to build with
  • Method Details

    • builder

      public static YoloV5Translator.Builder builder()
      Creates a builder to build a YoloV5Translator.
      Returns:
      a new builder
    • builder

      public static YoloV5Translator.Builder builder(Map<String,?> arguments)
      Creates a builder to build a YoloV5Translator with specified arguments.
      Parameters:
      arguments - arguments to specify builder options
      Returns:
      a new builder
    • nms

      protected DetectedObjects nms(int imageWidth, int imageHeight, List<Rectangle> boxes, List<Integer> classIds, List<Float> scores)
    • processFromBoxOutput

      protected DetectedObjects processFromBoxOutput(int imageWidth, int imageHeight, NDList list)
    • processOutput

      public DetectedObjects processOutput(TranslatorContext ctx, NDList list)
      Processes the output NDList to the corresponding output object.
      Parameters:
      ctx - the toolkit used for post-processing
      list - the output NDList after inference, usually immutable in engines like PyTorch. @see Issue 1774
      Returns:
      the output object of expected type