Writing deep learning code to recognize numbers 0 - 9, getting zero readings for my test values on tensorflow/python after training several epochs.
I already tried testing other values but my matrix returns 0 and my output value is stuck on zero.
The output also says:
I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2.
Couldn't really figure out what this means.
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
mnist = tf.keras.datasets.mnist #handwritten numbers
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = tf.keras.utils.normalize(x_train,axis=1)
x_test = tf.keras.utils.normalize(x_test,axis=1)
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(128, activation = tf.nn.relu))
model.add(tf.keras.layers.Dense(128, activation = tf.nn.relu))
model.add(tf.keras.layers.Dense(10, activation = tf.nn.relu))
model.compile(optimizer="adam",loss="sparse_categorical_crossentropy", metrics=["accuracy"])
model.fit(x_train, y_train, epochs = 8)
val_loss, val_acc = model.evaluate(x_test, y_test)
print(val_loss, val_acc)
# model.save("epic_num_reader.model")
# new_model = tf.keras.models.load_model("epic_num_reader.model")
predictions = model.predict([x_test])
print(predictions)
print(np.argmax(predictions[0]))
"""show image"""
plt.imshow(x_test[0])
plt.show()
# print(x_train[0])
The code is supposed to output 7
, and I can't figure out what is wrong with it.