MCPcopy Create free account
hub / github.com/XLearning-SCU/2022-CVPR-DART / AverageMeter

Class AverageMeter

utils.py:102–118  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

100
101
102class AverageMeter(object):
103 """Computes and stores the average and current value"""
104
105 def __init__(self):
106 self.reset()
107
108 def reset(self):
109 self.val = 0
110 self.avg = 0
111 self.sum = 0
112 self.count = 0
113
114 def update(self, val, n=1):
115 self.val = val
116 self.sum += val * n
117 self.count += n
118 self.avg = self.sum / self.count
119
120def mkdir_if_missing(directory):
121 if not osp.exists(directory):

Callers 1

trainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected