getImagePrediction method

Future<List<ResultObjectDetection?>> getImagePrediction(
  1. Uint8List imageAsBytes, {
  2. double minimumScore = 0.5,
  3. double IOUThershold = 0.5,
  4. int boxesLimit = 10,
})

Runs object detection and returns filtered results.

Processes the image through the model and returns detections that meet the specified confidence and overlap thresholds.

@param imageAsBytes The raw image bytes @param minimumScore Minimum confidence score for detections (0.0-1.0) @param IOUThershold Maximum overlap allowed between detections @param boxesLimit Maximum number of detections to return @return A Future that completes with a list of detection results

Implementation

Future<List<ResultObjectDetection?>> getImagePrediction(
    Uint8List imageAsBytes,
    {double minimumScore = 0.5,
    double IOUThershold = 0.5,
    int boxesLimit = 10}) async {
  List<ResultObjectDetection?> prediction = await ModelApi()
      .getImagePredictionListObjectDetection(_index, imageAsBytes, null, null,
          null, minimumScore, IOUThershold, boxesLimit);

  for (var element in prediction) {
    element?.className = labels[element.classIndex];
  }

  return prediction;
}