-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevaluate.py
More file actions
26 lines (20 loc) · 763 Bytes
/
Copy pathevaluate.py
File metadata and controls
26 lines (20 loc) · 763 Bytes
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
import torch
from datasets.dataset import PositioningDataset
from torch.utils.data import DataLoader
from models.model import PositioningModel
import yaml
with open("config.yaml", "r") as f:
config = yaml.safe_load(f)
dataset = PositioningDataset('data/choords.xlsx', 'data/images')
loader = DataLoader(dataset, batch_size=1, shuffle=False)
model = PositioningModel()
model.eval()
total_error = torch.zeros(3)
count = 0
with torch.no_grad():
for images, targets in loader:
outputs = model(images)
total_error += torch.sum(torch.abs(outputs - targets), dim=0)
count += images.size(0)
avg_error = total_error / count
print(f"Средняя ошибка: X={avg_error[0]:.3f}, Y={avg_error[1]:.3f}, Угол={avg_error[2]:.3f}")