getImagePrediction method

Future<List<ResultObjectDetection>> getImagePrediction(
  1. Uint8List imageAsBytes, {
  2. double minimumScore = 0.5,
  3. double iOUThreshold = 0.5,
  4. int boxesLimit = 10,
  5. PreProcessingMethod preProcessingMethod = PreProcessingMethod.imageLib,
})

Performs object detection on an image and returns a list of ResultObjectDetection with its assigned labels.

Parameters:

  • imageAsBytes: The image as bytes in Uint8List format.
  • minimumScore: The minimum confidence score for a detected object to be included in the results. Default is 0.5.
  • iOUThreshold: The threshold for intersection over union (IOU) to filter out redundant bounding boxes. Default is 0.5.
  • boxesLimit: The maximum number of bounding boxes to return. Default is 10.
  • preProcessingMethod: The preprocessing method to apply to the image before object detection. Default is PreProcessingMethod.imageLib.

Returns: A list of ResultObjectDetection containing the detected objects and their bounding boxes.

Implementation

Future<List<ResultObjectDetection>> getImagePrediction(Uint8List imageAsBytes,
    {double minimumScore = 0.5,
    double iOUThreshold = 0.5,
    int boxesLimit = 10,
    PreProcessingMethod preProcessingMethod =
        PreProcessingMethod.imageLib}) async {
  // Perform object detection on the image
  List<ResultObjectDetection> prediction = await getImagePredictionList(
      imageAsBytes,
      minimumScore: minimumScore,
      iOUThreshold: iOUThreshold,
      boxesLimit: boxesLimit,
      preProcessingMethod: preProcessingMethod);

  // Add labels to the detected objects
  addLabels(prediction);

  return prediction;
}