Computer Vision News - June 2022
53 Covid Predictor (with code) 0.6933 - val_accuracy: 0.5000 … Epoch 10/10 8/8 [==============================] - 9s 1s/step - loss: 0.1225 - accuracy: 0.9522 - val_loss: 0.1918 - val_accuracy: 0.9600 model.save("Covid19_XrayDetector.h5") model.evaluate_generator(train_generator) [0.02655816078186035, 0.991304337978363] model.evaluate_generator(validation_generator) [0.19179965555667877, 0.9599999785423279 Test Images model = load_model("Covid19_XrayDetector.h5") train_generator.class_indices {'Covid': 0, 'Normal': 1} Confusion Matrix By creating a confusion matrix we can get an idea of how well our model performs! from sklearn.metrics import confusion_matrix cm = confusion_matrix(y_actual,y_test) sns.heatmap(cm,cmap = "plasma",annot=True ) import itertools import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix class_names = ["Covid-19","Normal"] def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap="plasma")
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=