Skip to content

Commit

Permalink
Updated MNIST example: now saves ANN (trained) file (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenkj1 authored Jan 10, 2024
1 parent aa5303a commit 5f2ccec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions TensorflowExample/test-MNIST.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@
history = model.fit(train_images, train_labels, epochs=10)
print(history.history.keys())

# Save Model to file (contains weights, config, comp.inf. etc.)
mod_sfp = os.path.join(gPATHO, "MNIST_model.keras")
model.save(mod_sfp)

# This model datafile can be loaded using the line of code below
# model_ld = tf.keras.models.load_model(mod_sfp)

fig, ax = plt.subplots(figsize=(8, 6))
ax.plot(history.history['loss'], label='Loss fn')
ax.plot(history.history['accuracy'], label='Accuracy')
Expand Down
5 changes: 5 additions & 0 deletions TensorflowExample/test-mlgpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ spec:
type: png
description: >
A png graph showing image classification predictions (tensorflow)
- name: MNIST_model.keras
type: keras
description: >
This is the model file for the ANN containing the network weights, structure etc.
This can be loaded into a program and then used without the need for any further training.

0 comments on commit 5f2ccec

Please sign in to comment.