Is there a way to create a confusion Matrix on Tflite Model Maker - Image Classification that is similar to Audio Classification?
Hi @Hagen_Hagen
Take a look at those notebooks for showing confusion matrix with sklearn and matplotlib:
and
Finally this one with Model maker classes:
I think by combining you can print confusion matrix also for Image Classification task.
Best
Hi I followed the 3rd notebook and I get this error.
AttributeError: 'ImageClassifier' object has no attribute 'confusion_matrix'
Maybe âImageClassifierâ object has no attribute 'confusion_matrix then. So create it customly by following the 2 first notebook with sklearn and matplotlib.
Best
What I would, while itâs not available on the ImageClassifier, is to copy what AudioClassifier is doing: examples/tensorflow_examples/lite/model_maker/core/task/audio_classifier.py at 1ff6d7aa9bdf9749ada28bf67ad435ca518b6232 ¡ tensorflow/examples ¡ GitHub
the code might be easy to copy/adapt
Where will I put the code? Inside the image_classifier.py? or just in another cell in Jupyter Notebook?
Iâd just create another cell with a function.
that is the easiest solution
I put it inside the image_classifier.py and it worked. Will that be fine?
I guess so, if itâs working for you thatâs enough, right?
@Hagen_Hagen
Create a PR with that fix.
I am getting the same error âAttributeError: âImageClassifierâ object has no attribute âconfusion_matrixââ when I put it in another cell, I think putting it inside image_classifier.py would be fine since thereâs no error and âmodel.confusion_matrixâ worked since I put it inside the image_classifier.py. I just thought it will break the package, but it worked. Thank you so much for the help guys!
Hi @Hagen_Hagen
Checkout this link https://tensorexamples.com/2020/07/23/Quantize-your-model-using-tflite.html