Last active
February 3, 2021 13:49
-
-
Save kumarvipu1/b00e201fb925759f2583f182c1e2c66c to your computer and use it in GitHub Desktop.
image classifier part 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#reshaping the independant variables | |
train_X = train_X.reshape(train_X.shape[0], 28, 28, 1) | |
val_X = val_X .reshape(val_X.shape[0], 28, 28, 1) | |
#encoding the dependant variable | |
train_y = np.eye(10)[train_y] | |
val_y = np.eye(10)[val_y] | |
#creating model | |
model = create_model((28,28,1)) | |
#optimizing model | |
compile_model(model, 'adam', 'categorical_crossentropy') | |
#training model | |
history = model.fit(train_X, train_y, validation_data = (val_X, val_y), batch_size = 150, epochs = 80) | |
model.save("cnn_digitclass.model") #model will be save in root folder to be later called out for prediction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment