Class OpenCVDnn.Builder

java.lang.Object
qupath.opencv.dnn.OpenCVDnn.Builder
Enclosing class:
OpenCVDnn

public static class OpenCVDnn.Builder extends Object
Helper class to build an OpenCVDnn.
  • Method Details

    • framework

      public OpenCVDnn.Builder framework(String name)
      Specify the framework (used to identify the appropriate loader for the model).
      Parameters:
      name -
      Returns:
    • config

      public OpenCVDnn.Builder config(String pathConfig)
      Path to config file (if required).
      Parameters:
      pathConfig -
      Returns:
    • config

      public OpenCVDnn.Builder config(URI pathConfig)
      Path to config file (if required).
      Parameters:
      pathConfig -
      Returns:
    • name

      public OpenCVDnn.Builder name(String name)
      User-friendly name to use with this model.
      Parameters:
      name -
      Returns:
    • opencl

      public OpenCVDnn.Builder opencl()
      Specify OpenCL target. It probably won't help, but perhaps worth a try.
      Returns:
    • opencl16

      public OpenCVDnn.Builder opencl16()
      Specify OpenCL target with 16-bit floating point. It probably won't help, but perhaps worth a try.
      Returns:
    • cuda

      public OpenCVDnn.Builder cuda()
      Request CUDA backend and target, if available.
      Returns:
    • cpu

      public OpenCVDnn.Builder cpu()
      Request CPU backend and target, if available.
      Returns:
    • cuda16

      public OpenCVDnn.Builder cuda16()
      Request CUDA backend and target, if available, with 16-bit floating point.
      Returns:
    • target

      public OpenCVDnn.Builder target(int target)
      Specify the target, e.g. opencv_dnn.DNN_TARGET_CUDA.
      Parameters:
      target -
      Returns:
      See Also:
    • backend

      public OpenCVDnn.Builder backend(int backend)
      Specify the backend, e.g. opencv_dnn.DNN_BACKEND_CUDA.
      Parameters:
      backend -
      Returns:
      See Also:
    • mean

      public OpenCVDnn.Builder mean(Scalar mean)
      Mean values which should be subtracted from the image channels before input to the Net.
      Parameters:
      mean -
      Returns:
    • scale

      public OpenCVDnn.Builder scale(double scale)
      Scale values, by which channels should be multiplied (after mean subtraction) before input to the Net.
      Parameters:
      scale -
      Returns:
    • size

      public OpenCVDnn.Builder size(int width, int height)
      Input width and height.
      Parameters:
      width -
      height -
      Returns:
    • size

      public OpenCVDnn.Builder size(Size size)
      Input width and height.
      Parameters:
      size -
      Returns:
    • modelType

      public OpenCVDnn.Builder modelType(OpenCVDnn.ModelType type)
      Set the model type, used by OpenCVDnn.buildModel().
      Parameters:
      type -
      Returns:
    • classification

      public OpenCVDnn.Builder classification()
      Set the model type to be OpenCVDnn.ModelType.CLASSIFICATION.
      Returns:
    • segmentation

      public OpenCVDnn.Builder segmentation()
      Set the model type to be OpenCVDnn.ModelType.SEGMENTATION.
      Returns:
    • detection

      public OpenCVDnn.Builder detection()
      Set the model type to be OpenCVDnn.ModelType.DETECTION.
      Returns:
    • outputs

      public OpenCVDnn.Builder outputs(String... layers)
      Set the layer outputs. Usually this isn't necessary, but it provides a means to output features prior to any final classification.
      Parameters:
      layers -
      Returns:
    • outputs

      public OpenCVDnn.Builder outputs(Map<String,DnnShape> outputs)
      Set the layer outputs and shapes. Usually this isn't necessary, but it provides a means to output features prior to any final classification.
      Parameters:
      outputs -
      Returns:
    • build

      public OpenCVDnn build()
      Build a new OpenCVDnn.
      Returns: