Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
837 views
in Technique[技术] by (71.8m points)

precision - How to improve Confusion Matrix scores for 3 Class - Covid19 Detection chest xrays images of 3 classes (covid , normal, viral pneumonia)

#I am using the below code and the report is being generated but the scores are not good (approx 0.31). #However, during training and testing the performance of model is above 90%.

#Note: "eval_batches" is the dataset used during the training phase to check the val_accuracy.

#(4/4 - 19s - loss: 0.2456 - accuracy: 0.9000 - val_loss: 0.2301 - val_accuracy: 0.9500)

#Confution Matrix and Classification Report

from sklearn.metrics import classification_report

batch_size = 10
num_of_train_samples = 2721
num_of_eval_samples = 583


Y_pred = model.predict_generator(eval_batches, num_of_eval_samples // batch_size+1)
y_pred = np.argmax(Y_pred, axis=1)
print('Confusion Matrix')
print(confusion_matrix(eval_batches.classes, y_pred))
print('Classification Report')
target_names = ['COVID-19','NORMAL','Viral_Pneumonia']
print(classification_report(eval_batches.classes, y_pred, target_names=target_names))

#Classification ReportBelow is the Output:

""

Confusion Matrix
[[58 58 64]
 [66 56 79]
 [59 69 74]]
Classification Report

                 precision    recall  f1-score   support

       COVID-19       0.32      0.32      0.32       180
         NORMAL       0.31      0.28      0.29       201
Viral_Pneumonia       0.34      0.37      0.35       202

       accuracy                           0.32       583
      macro avg       0.32      0.32      0.32       583
   weighted avg       0.32      0.32      0.32       583

"" Please help me to get better scores in the confusion matrix.

Any help will be highly appreciated !!!

question from:https://stackoverflow.com/questions/65897172/how-to-improve-confusion-matrix-scores-for-3-class-covid19-detection-chest-xra

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...