File size: 769 Bytes
137b0e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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])