Superxixixi commited on
Commit
29ac319
·
1 Parent(s): d828569

Delete metrics

Browse files
metrics/AverageMeter.py DELETED
@@ -1,18 +0,0 @@
1
- #taken from pytorch imagenet example
2
- class AverageMeter(object):
3
- """Computes and stores the average and current value"""
4
- def __init__(self):
5
- self.reset()
6
-
7
- def reset(self):
8
- self.val = 0
9
- self.avg = 0
10
- self.sum = 0
11
- self.count = 0
12
-
13
- def update(self, val, n=1):
14
- self.val = val
15
- self.sum += val * n
16
- self.count += n
17
- self.avg = self.sum / self.count
18
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
metrics/__pycache__/.nfs000000035f4a8257000000eb DELETED
Binary file (896 Bytes)
 
metrics/__pycache__/AverageMeter.cpython-36.pyc DELETED
Binary file (897 Bytes)
 
metrics/__pycache__/AverageMeter.cpython-38.pyc DELETED
Binary file (908 Bytes)
 
metrics/__pycache__/accuracy.cpython-36.pyc DELETED
Binary file (870 Bytes)
 
metrics/__pycache__/accuracy.cpython-38.pyc DELETED
Binary file (876 Bytes)
 
metrics/accuracy.py DELETED
@@ -1,20 +0,0 @@
1
- import torch
2
-
3
- accuracy = lambda output,target : acc_topk(output, target)[0]
4
-
5
- #taken from pytorch imagenet example
6
- def acc_topk(output, target, topk=(1,)):
7
- """Computes the accuracy over the k top predictions for the specified values of k"""
8
- with torch.no_grad():
9
- maxk = max(topk)
10
- batch_size = target.size(0)
11
-
12
- _, pred = output.topk(maxk, 1, True, True)
13
- pred = pred.t()
14
- correct = pred.eq(target.view(1, -1).expand_as(pred))
15
-
16
- res = []
17
- for k in topk:
18
- correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
19
- res.append(correct_k.mul_(1.0 / batch_size))
20
- return res