MCPcopy Create free account
hub / github.com/Walter0807/MotionBERT / AverageMeter

Class AverageMeter

lib/utils/learning.py:8–23  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

6from lib.model.DSTformer import DSTformer
7
8class AverageMeter(object):
9 """Computes and stores the average and current value"""
10 def __init__(self):
11 self.reset()
12
13 def reset(self):
14 self.val = 0
15 self.avg = 0
16 self.sum = 0
17 self.count = 0
18
19 def update(self, val, n=1):
20 self.val = val
21 self.sum += val * n
22 self.count += n
23 self.avg = self.sum / self.count
24
25def accuracy(output, target, topk=(1,)):
26 """Computes the accuracy over the k top predictions for the specified values of k"""

Callers 6

validateFunction · 0.85
train_with_configFunction · 0.85
train_with_configFunction · 0.85
train_with_configFunction · 0.85
validateFunction · 0.85
train_with_configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected