MCPcopy Create free account
hub / github.com/drinkingcoder/FlowFormer-Official / validate_chairs

Function validate_chairs

evaluate_FlowFormer.py:27–44  ·  view source on GitHub ↗

Perform evaluation on the FlyingChairs (test) split

(model)

Source from the content-addressed store, hash-verified

25
26@torch.no_grad()
27def validate_chairs(model):
28 """ Perform evaluation on the FlyingChairs (test) split """
29 model.eval()
30 epe_list = []
31
32 val_dataset = datasets.FlyingChairs(split='validation')
33 for val_id in range(len(val_dataset)):
34 image1, image2, flow_gt, _ = val_dataset[val_id]
35 image1 = image1[None].cuda()
36 image2 = image2[None].cuda()
37 flow_pre, _ = model(image1, image2)
38
39 epe = torch.sum((flow_pre[0].cpu() - flow_gt)**2, dim=0).sqrt()
40 epe_list.append(epe.view(-1).numpy())
41
42 epe = np.mean(np.concatenate(epe_list))
43 print("Validation Chairs EPE: %f" % epe)
44 return {'chairs': epe}
45
46
47@torch.no_grad()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected