I use Visdom vis.line() to draw the loss during training. But after a period of time, the loss window disappear in the env and not shown in the browser.
The loss draw function is as follows,
def plot_current_losses(self, iter_id, losses, opt):
"""
Plot losses in one figure current epoch
Args:
losses: dict
{'loss_1': value, 'loss_2': value}
"""
if not hasattr(self, 'plot_data'):
self.plot_data = {'x': [], 'y': [], 'legend': list(losses.keys())}
# @rivergold: Here is different from CycleGAN
self.plot_data['x'].append(iter_id)
self.plot_data['y'].append([losses[k]
for k in self.plot_data['legend']])
try:
self.vis.line(
# Here X shape is [n_losses, n_epoch]
X=np.array(self.plot_data['x']),
Y=np.array(self.plot_data['y']),
opts={
'title': opt.name,
'legend': self.plot_data['legend'],
'xlabel': 'iter_id',
'ylabel': 'loss'},
win=self.win_id,
env=self.env
)
except ConnectionError:
self._throw_visdom_connection_error()
There is no Error raised, but the loss window disappear…Why?