MCPcopy Create free account
hub / github.com/Modulus-Labs/RockyBot / plot_losses_ious

Function plot_losses_ious

pytorch-model/viz_utils.py:26–55  ·  view source on GitHub ↗

Plots and saves.

(losses_dict, ious_dict, viz_path, prefix='train')

Source from the content-addressed store, hash-verified

24
25
26def plot_losses_ious(losses_dict, ious_dict, viz_path, prefix='train'):
27 """
28 Plots and saves.
29 """
30 title_prefix = str.upper(prefix[0]) + prefix[1:]
31
32 loss_epochs = list(losses_dict.keys())
33 losses = list(losses_dict[x] for x in loss_epochs)
34 iou_epochs = list(ious_dict.keys())
35 ious = list(ious_dict[x] for x in iou_epochs)
36
37 loss_path = os.path.join(viz_path, prefix + '_losses.png')
38 print(f'Saving losses to {loss_path}...')
39 loss_plot = sns.lineplot(x=loss_epochs, y=losses)
40 plt.title(title_prefix + ' Loss / Epoch')
41 plt.ylabel(title_prefix + ' Loss')
42 plt.xlabel('Epoch')
43 fig = loss_plot.get_figure()
44 fig.savefig(loss_path)
45 plt.clf()
46
47 iou_path = os.path.join(viz_path, prefix + '_ious.png')
48 print(f'Saving ious to {iou_path}...')
49 iou_plot = sns.lineplot(x=iou_epochs, y=ious)
50 plt.title(title_prefix + ' Iou / Epoch')
51 plt.ylabel(title_prefix + ' iou')
52 plt.xlabel('Epoch')
53 fig = iou_plot.get_figure()
54 fig.savefig(iou_path)
55 plt.clf()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected