space-codes / asar.core

This is our graduation project for arabic manuscript analysis and recognition
0 stars 0 forks source link

Evaluate training and testing metrics using mAP (mean average precision) for imblanced data #16

Open aboelkassem opened 2 years ago

aboelkassem commented 2 years ago
aboelkassem commented 2 years ago

check this code https://github.com/GuillermoJaca/Word-Spotting-in-Handwritten-Documents/blob/main/cnn_ws_experiments/evaluation/retrieval.py

aboelkassem commented 2 years ago

sklearn

# predict probabilities for test set
yhat_probs = model.predict(testX, verbose=1)
# predict crisp classes for test set
yhat_classes = model.predict_classes(testX, verbose=1)

# accuracy: (tp + tn) / (p + n)
accuracy = accuracy_score(testy, yhat_classes)
print('Accuracy: %f' % accuracy)
# precision tp / (tp + fp)
precision = precision_score(testy, yhat_classes)
print('Precision: %f' % precision)
# recall: tp / (tp + fn)
recall = recall_score(testy, yhat_classes)
print('Recall: %f' % recall)
# f1: 2 tp / (2 tp + fp + fn)
f1 = f1_score(testy, yhat_classes)
print('F1 score: %f' % f1)