addLabels method

void addLabels(
  1. List<ResultObjectDetection> prediction
)

Adds labels to the given list of prediction objects.

The labels are added based on the class index of each prediction object. The class name is retrieved from the labels list using the class index, and assigned to the className property of each prediction object.

Parameters:

  • prediction: The list of prediction objects to add labels to.

Implementation

void addLabels(List<ResultObjectDetection> prediction) {
  for (var element in prediction) {
    // Retrieve the class name from the labels list using the class index
    element.className = labels[element.classIndex];
  }
}