MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / RunningAverageDict

Class RunningAverageDict

dzoedepth/utils/misc.py:74–94  ·  view source on GitHub ↗

A dictionary of running averages.

Source from the content-addressed store, hash-verified

72
73
74class RunningAverageDict:
75 """A dictionary of running averages."""
76 def __init__(self):
77 self._dict = None
78
79 def update(self, new_dict):
80 if new_dict is None:
81 return
82
83 if self._dict is None:
84 self._dict = dict()
85 for key, value in new_dict.items():
86 self._dict[key] = RunningAverage()
87
88 for key, value in new_dict.items():
89 self._dict[key].append(value)
90
91 def get_value(self):
92 if self._dict is None:
93 return None
94 return {key: value.get_value() for key, value in self._dict.items()}
95
96
97def colorize(value, vmin=None, vmax=None, cmap='gray_r', invalid_val=-99, invalid_mask=None, background_color=(128, 128, 128, 255), gamma_corrected=False, value_transform=None):

Callers 1

validateMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected