Open antopost opened 4 months ago
Fixed it. The error message does give some clues. The np arrays must be uint16 and they must be passed within a list. That being said, it doesn't really make sense to me why this would be the case. The example code in the docs should work as well.
Here's the fixed example:
import numpy as np
import evaluate
mean_iou = evaluate.load("mean_iou")
predicted = np.array([[2, 2, 3], [8, 2, 4], [3, 255, 2]], dtype=np.uint16)
ground_truth = np.array([[1, 2, 2], [8, 2, 1], [3, 255, 1]], dtype=np.uint16)
results = mean_iou.compute(predictions=[predicted], references=[ground_truth], num_labels=10, ignore_index=255)
Getting this error when trying to compute IoU using the Huggingface example. Flattening arrays does not solve the problem as this issue suggests.
Steps to reproduce:
Using evaluate 0.4.1 numpy 1.26.1
Full error: