'Means of test accurancy and test loss
Friends! I learn "Face Anti-Spoofing using Deep-Pixel-wise-Binary-Supervision". But I have some question because I learn CNN not long time and I can not understand it now. What means test accurancy and test loss below?
def test_accuracy(model, test_dl):
acc = 0
total = len(test_dl.dataset)
for img, mask, label in test_dl:
net_mask, net_label = model(img)
preds, _ = predict(net_mask, net_label)
ac = (preds == label).type(torch.FloatTensor)
acc += torch.sum(ac).item()
return (acc / total) * 100
def test_loss(model, test_dl, loss_fn):
loss = 0
total = len(test_dl)
for img, mask, label in test_dl:
net_mask, net_label = model(img)
losses = loss_fn(net_mask, net_label, mask, label)
loss += torch.mean(losses).item()
#print("test_loss", loss / total)
return loss / total
I have some results for it
Loss : 0.07998281717300415
Loss : 0.08673418313264847
Loss : 0.10741370171308517
Loss : 0.0790242850780487
Loss : 0.07877358794212341
Loss : 0.09408798813819885
Loss : 0.08567623794078827
Loss : 0.09206777065992355
Loss : 0.08444041013717651
Test Accuracy : 100.0 Test Loss : 0.07839797969375338
Training Complete
Can it be true? Thank you very much!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
