Spaces:
Sleeping
Sleeping
import torch | |
import numpy as np | |
import fiftyone as fo | |
# from box_metrics import BoxMetrics | |
from seametrics.fo_utils.utils import fo_to_payload | |
from tqdm import tqdm | |
import evaluate | |
bbox_metric = evaluate.load("box_metrics.py") | |
references = [torch.tensor([ | |
[0,0,0,50,50], | |
[0,50,50,100,100], | |
[0,100,100,150,150] | |
])] | |
predictions = {"model": [torch.tensor([ | |
[0,0,50,50,0,0], | |
[50,50,90,90,0,0], | |
[100,100,140,140,0,0], | |
[100,100,130,130,0,0] | |
])] | |
} | |
bbox_metric.add_batch(predictions, references) | |
print(bbox_metric.boxes) | |
result = bbox_metric.compute() | |
for metric in result["sequence"]["model"]: | |
print(metric, result["sequence"]["model"][metric]) | |