From a1767ed4ba619f02315e073f012c34be6f47ab7b Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Tue, 14 Sep 2021 12:00:13 -0500
Subject: [PATCH] snapshot...

---
 modules/util/plot_cm.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/util/plot_cm.py b/modules/util/plot_cm.py
index c821cee3..eafcb4c6 100644
--- a/modules/util/plot_cm.py
+++ b/modules/util/plot_cm.py
@@ -1,5 +1,6 @@
 from textwrap import wrap
 import re
+import os
 import itertools
 #import tfplot
 import matplotlib
@@ -8,18 +9,18 @@ from sklearn.metrics import confusion_matrix
 import matplotlib.pyplot as plt
 
 
-def plot_confusion_matrix_values(correct_labels, predict_labels, labels, title='Confusion matrix', tensor_name = 'MyFigure/image', normalize=False):
+def plot_confusion_matrix_values(correct_labels, predict_labels, labels, title='Confusion matrix', filename='confusion_matrix', normalize=False):
     cm = confusion_matrix(correct_labels, predict_labels)
 
 
-def plot_confusion_matrix(cm, labels, title='Confusion matrix', tensor_name = 'MyFigure/image', normalize=False):
+def plot_confusion_matrix(cm, labels, title='Confusion matrix', filename = 'confusion_matrix', normalize=False):
     '''
     Parameters:
         correct_labels                  : These are your true classification categories.
         predict_labels                  : These are you predicted classification categories
         labels                          : This is a list of labels which will be used to display the axis labels
         title='Confusion matrix'        : Title for your matrix
-        tensor_name = 'MyFigure/image'  : Name for the output summay tensor
+        filename = 'confusion_matrix'   : Name for the output summay tensor
 
     Returns:
         summary: TensorFlow summary
@@ -59,3 +60,6 @@ def plot_confusion_matrix(cm, labels, title='Confusion matrix', tensor_name = 'M
     for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):
         ax.text(j, i, format(cm[i, j], 'd') if cm[i,j]!=0 else '.', horizontalalignment="center", fontsize=6, verticalalignment='center', color= "black")
     fig.set_tight_layout(True)
+
+    ImageDirAndName = os.path.join('/Users/tomrink', filename)
+    fig.savefig(ImageDirAndName)
-- 
GitLab