getImagePredictionListFromBytesList method

Future<List<double?>?> getImagePredictionListFromBytesList(
  1. List<Uint8List> imageAsBytesList,
  2. int imageWidth,
  3. int imageHeight, {
  4. List<double> mean = TORCHVISION_NORM_MEAN_RGB,
  5. List<double> std = TORCHVISION_NORM_STD_RGB,
})

Runs batch image classification and returns raw prediction scores.

Processes multiple images in a single batch and returns raw scores. Useful for custom post-processing or ensemble methods.

@param imageAsBytesList List of raw image bytes @param imageWidth The width to resize images to @param imageHeight The height to resize images to @param mean Optional normalization mean values (default: ImageNet means) @param std Optional normalization std values (default: ImageNet stds) @return A Future that completes with a list of raw prediction scores

Implementation

Future<List<double?>?> getImagePredictionListFromBytesList(
    List<Uint8List> imageAsBytesList, int imageWidth, int imageHeight,
    {List<double> mean = TORCHVISION_NORM_MEAN_RGB,
    List<double> std = TORCHVISION_NORM_STD_RGB}) async {
  // Assert mean std
  assert(mean.length == 3, "Mean should have size of 3");
  assert(std.length == 3, "STD should have size of 3");
  final List<double?> prediction = await ModelApi().getImagePredictionList(
      _index, null, imageAsBytesList, imageWidth, imageHeight, mean, std);
  return prediction;
}