isnjb27 commited on
Commit
ca564f4
1 Parent(s): fc09124

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +21 -0
utils.py CHANGED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tensorflow as tf
2
+ import matplotlib.pyplot as plt
3
+
4
+
5
+ def plot_accuracy(history):
6
+ plt.plot(history.history["accuracy"], label="train")
7
+ plt.plot(history.history["val_accuracy"], label="validation")
8
+ plt.legend()
9
+ plt.show()
10
+
11
+
12
+ def plot_loss(history):
13
+ plt.plot(history.history["loss"], label="train")
14
+ plt.plot(history.history["val_loss"], label="validation")
15
+ plt.legend()
16
+ plt.show()
17
+
18
+
19
+ def process(image, label):
20
+ image = tf.cast(image / 255.0, tf.float32)
21
+ return image, label