crobbi commited on
Commit
d2513bf
1 Parent(s): 76eace5

Create modelutil.py

Browse files
Files changed (1) hide show
  1. modelutil.py +20 -0
modelutil.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tensorflow as tf
2
+
3
+ LAYERS = [tf.keras.layers.Flatten(input_shape=[28,28], name="inputlayer"),
4
+ tf.keras.layers.Dense(300, activation='relu', name="hiddenlayer1"),
5
+ tf.keras.layers.Dense(100, activation='relu', name="hiddenlayer2"),
6
+ tf.keras.layers.Dense(10, activation='softmax', name="outputlayer")]
7
+
8
+ model = tf.keras.models.Sequential(LAYERS)
9
+
10
+ model.load_weights('./checkpoint')
11
+
12
+
13
+ LOSS_FUNCTION = tf.keras.losses.SparseCategoricalCrossentropy() # HERE
14
+ OPTIMIZER = "ADAM"
15
+ METRICS = ["accuracy"]
16
+ model.compile(loss=LOSS_FUNCTION,
17
+ optimizer=OPTIMIZER,
18
+ metrics=METRICS)
19
+
20
+