Reputation: 831
The MNIST dataset has all 10 numbers to train with. If I predict a 9
, the model will give as output a 9
. But, what if I want to predict the number 34.542
? It will give me a wrong number, since I have only trained from 0 to 9. So, how could I predict a > 9
number?
This is my code, but I think it will not be useful here
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(units=128, activation=tf.nn.relu))
model.add(tf.keras.layers.Dense(units=128, activation=tf.nn.relu))
model.add(tf.keras.layers.Dense(units=10, activation=tf.nn.softmax))
# Compiling and optimizing model
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
# Training the model
model.fit(X_train, y_train, epochs=3)
Upvotes: 1
Views: 339
Reputation: 472
As said in the comments, you can't apply your model directly on an image of a large number. You have to :
See this article for example.
Upvotes: 2