0

I am using tensor flow object detect pre-trained model with faster RCNN inception_v2 coco for own data set. So my question is how to find model accuracy and confusion matrix for own data set?

arka mandal
  • 1
  • 1
  • 1
  • For object detection task, the evaluation metric is usually `mean average precision` (mAP). Why would you want confusion matrix (which is for classification task) for object detection? – Danny Fang Jun 04 '19 at 07:36
  • Does this answer your question? [What's the correct way to compute a confusion matrix for object detection?](https://stackoverflow.com/questions/46110545/whats-the-correct-way-to-compute-a-confusion-matrix-for-object-detection) – Emanuel Huber Sep 14 '20 at 18:53

1 Answers1

0

if you want to get a confusion matrix is easy, this example works with PyCM library: First, train your model with your 80% and then use the hold-out test or also called "test data" or x_test. The hold out test data the model will predict classes with data that never see before, if you train your model using all your data, the model only will make a "peeking" this term refers to the model only is "peeking" the features and never predicting because only doing a "peeking" the data that before it saw.

I.g to get a confusion matrix, first we test the model with the test data:

y_predicted = model.predict(testX, batch_size=64)

And the we get the confusion matrix using PyCM library

from pycm import *

And the get the cm:

cm = ConfusionMatrix(actual_vector=y_test, predict_vector=y_predicted)

print(cm)

Printing the "cm" you will get all the metrics of your model like "recall, precision, overall accuracy of your model, specificity, all what you can get from a Confusion matrix, getting the CM also you can compute from scratch your precision, recall of true positive rate, true negative rate of every class etc.. those metrics tells you how confident is your model..

Best Regards..

Freddy Daniel
  • 369
  • 2
  • 16