So the problem was that the train and test images was already rescaled (from 0:255 -> 0:1) in other words pixels of the images was normalized to 1. Then the predicted results was like dog, dog, dog, dog. Then I started to capture images from my webcam and what not. When I use to predict images from my test batch everything seem to be OK 99% accuracy. I've train my dataset (natural images) on Xception model which gives me >99% and I was amazed.īut then I started to use model.predict function in many ways and I notices one weird thing. So I don't know if I'm facing the same issue or not, so I will describe my problem below: Gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) Print("Test Accuracy with first 50 epochs: %.2f%%" % (score*100)) Predict unseen image Score = model.evaluate(X_test, Y_test, verbose = 0) Model.load_weights('saved_models/best_model.hdf5') 10. Noaugmented_history_epoch = model.fit(X_train, Y_train,Įpochs=epochs, batch_size=batch_size, callbacks=, verbose=1) pile(optimizer='Adamax', loss='categorical_crossentropy', metrics=)įrom keras.callbacks import ModelCheckpointīatch_size = 128 Do NOT modify the code below this line.Ĭheckpointer = ModelCheckpoint(filepath='saved_models/local_machine_DigitAlpha_EMNIST_best_model.hdf5', #pile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=) Model.add(Dense(62, activation='softmax')) Model.add(Conv2D(filters=64, kernel_size=3, activation='relu')) Model.add(Conv2D(filters=32, kernel_size=3, activation='relu')) Y_test = np_utils.to_categorical(y_test, nb_classes) Define Model Architecture Y_train = np_utils.to_categorical(y_train, nb_classes) X_test /= 255 convert class vectors to binary class matrices (ie one-hot vectors) Y_test = test # First data is label (already removed from Y_train) Make the value floats in instead of int in Y_train = train # First data is label (already removed from X_train) X_test = test.reshape(test.shape, img_rows, img_cols, 1) X_train = train.reshape(train.shape, img_rows, img_cols, 1) Test = pd.read_csv("emnist/emnist-byclass-test.csv").values Train = pd.read_csv("emnist/emnist-byclass-train.csv").values Np.ed(1337) # for reproducibilityįrom import Dense, Dropout, Activation, Flattenįrom import Convolution2D, MaxPooling2Dįrom keras.callbacks import Callback, RemoteMonitor
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |