MCPcopy Create free account
hub / github.com/ZhengPeng7/BiRefNet / AverageMeter

Class AverageMeter

utils.py:62–77  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

60
61
62class AverageMeter(object):
63 """Computes and stores the average and current value"""
64 def __init__(self):
65 self.reset()
66
67 def reset(self):
68 self.val = 0.0
69 self.avg = 0.0
70 self.sum = 0.0
71 self.count = 0.0
72
73 def update(self, val, n=1):
74 self.val = val
75 self.sum += val * n
76 self.count += n
77 self.avg = self.sum / self.count
78
79
80def save_checkpoint(state, path, filename="latest.pth"):

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected