I get an average of precision 82.59 and recall 69.84 using bboxPrecisionRecall for segmenting Arabic words algorithm. I need to calculate TN, FP, FN, and TP using the confusion matrix to evaluate the performance of the model. Is the precision same as the accuracy? If not, how can I calculate it? The segmentation method applied to 1131 images and compared with ground truth.
I am not too sure about how the confusion matrix is arranged in MATLAB, but in Python, the one imported from sklearn.metrics is arranged as such:
from sklearn.metrics import confusion_matrix
confusion_matrix(ground_truth, predictions) = array([[TN, FP],
FN, TP]])
Accuracy is not the same as precision. Precision is measured using TP/(TP+FP) while accuracy is measured using (TP+TN)/(TP+TN+FP+FN)