Class ObjectDetectionTranslator.ObjectDetectionBuilder<T extends ObjectDetectionTranslator.ObjectDetectionBuilder>

Direct Known Subclasses:
SingleShotDetectionTranslator.Builder, YoloTranslator.Builder, YoloV5Translator.Builder
Enclosing class:
ObjectDetectionTranslator

public abstract static class ObjectDetectionTranslator.ObjectDetectionBuilder<T extends ObjectDetectionTranslator.ObjectDetectionBuilder> extends BaseImageTranslator.ClassificationBuilder<T>
The base builder for the object detection translator.
  • Field Details

    • threshold

      protected float threshold
    • imageWidth

      protected double imageWidth
    • imageHeight

      protected double imageHeight
    • applyRatio

      protected boolean applyRatio
  • Constructor Details

    • ObjectDetectionBuilder

      public ObjectDetectionBuilder()
  • Method Details

    • optThreshold

      public T optThreshold(float threshold)
      Sets the threshold for prediction accuracy.

      Predictions below the threshold will be dropped.

      Parameters:
      threshold - the threshold for the prediction accuracy
      Returns:
      this builder
    • optRescaleSize

      public T optRescaleSize(double imageWidth, double imageHeight)
      Sets the optional rescale size.
      Parameters:
      imageWidth - the width to rescale images to
      imageHeight - the height to rescale images to
      Returns:
      this builder
    • optApplyRatio

      public T optApplyRatio(boolean value)
      Determine Whether to divide output object width/height on the inference result. Default false.

      DetectedObject value should always bring a ratio based on the width/height instead of actual width/height. Most of the model will produce ratio as the inference output. This function is aimed to cover those who produce the pixel value. Make this to true to divide the width/height in postprocessing in order to get ratio in detectedObjects.

      Parameters:
      value - whether to apply ratio
      Returns:
      this builder
    • getImageWidth

      public double getImageWidth()
      Get resized image width.
      Returns:
      image width
    • getImageHeight

      public double getImageHeight()
      Get resized image height.
      Returns:
      image height
    • configPostProcess

      protected void configPostProcess(Map<String,?> arguments)
      Overrides:
      configPostProcess in class BaseImageTranslator.ClassificationBuilder<T extends ObjectDetectionTranslator.ObjectDetectionBuilder>