Happy new years
This commit is contained in:
1 parent
c7175dd7ff
commit
8c4865effb
53 files changed
+4604
-61
No files matched your search
@@ -167,6 +167,43 @@ class Visualizer():
|
||||
webpage.add_images(ims, txts, links, width=self.opt.VISUAL.vsdm_wsize)
|
||||
webpage.save()
|
||||
|
||||
|
||||
def plot_current_losses_valid(self, epoch, counter_ratio, losses):
|
||||
"""display the current losses on visdom display: dictionary of error labels and values
|
||||
|
||||
Parameters:
|
||||
epoch (int) -- current epoch
|
||||
counter_ratio (float) -- progress (percentage) in the current epoch, between 0 to 1
|
||||
losses (OrderedDict) -- training losses stored in the format of (name, float) pairs
|
||||
"""
|
||||
if not self.opt.VISUAL.use_visdom: return
|
||||
|
||||
if not hasattr(self, 'plot_data_valid'):
|
||||
self.plot_data_valid = {'X': [], 'Y': [], 'legend': list(losses.keys())}
|
||||
|
||||
self.plot_data_valid['X'].append(epoch + counter_ratio)
|
||||
self.plot_data_valid['Y'].append([losses[k] for k in self.plot_data_valid['legend']])
|
||||
|
||||
try:
|
||||
# print("np.array(self.plot_data_valid['X'])=", np.array(self.plot_data_valid['X']))
|
||||
# print("np.array(self.plot_data_valid['Y'])=", np.array(self.plot_data_valid['Y']))
|
||||
# print("self.plot_data_valid['legend']", self.plot_data_valid['legend'])
|
||||
|
||||
self.vis.line(
|
||||
X=np.stack([np.array(self.plot_data_valid['X'])] * len(self.plot_data_valid['legend']), 1),
|
||||
Y=np.array(self.plot_data_valid['Y']),
|
||||
opts={
|
||||
'title': self.name + ' loss over time (valid)',
|
||||
'legend': self.plot_data_valid['legend'],
|
||||
'xlabel': 'epoch',
|
||||
'ylabel': 'loss'},
|
||||
win=self.opt.VISUAL.vsdm_id + 1000)
|
||||
|
||||
except Exception:
|
||||
raise("CANNOT vis line")
|
||||
self.create_visdom_connections()
|
||||
|
||||
|
||||
def plot_current_losses(self, epoch, counter_ratio, losses):
|
||||
"""display the current losses on visdom display: dictionary of error labels and values
|
||||
|
||||
@@ -188,7 +225,6 @@ class Visualizer():
|
||||
# print("np.array(self.plot_data['Y'])=", np.array(self.plot_data['Y']))
|
||||
# print("self.plot_data['legend']", self.plot_data['legend'])
|
||||
|
||||
|
||||
self.vis.line(
|
||||
X=np.stack([np.array(self.plot_data['X'])] * len(self.plot_data['legend']), 1),
|
||||
Y=np.array(self.plot_data['Y']),
|
||||
@@ -198,6 +234,7 @@ class Visualizer():
|
||||
'xlabel': 'epoch',
|
||||
'ylabel': 'loss'},
|
||||
win=self.opt.VISUAL.vsdm_id)
|
||||
|
||||
except Exception:
|
||||
raise("CANNOT vis line")
|
||||
self.create_visdom_connections()
|
||||
|
||||
Reference in new issue
Block a user