i have a very confusion for my thesis code to prepare the confusion matrix i have done the feature extraction using pytorch code with transfer learning computer vision so my data is photographers identification using the convolutional neural networks using different resnets 18,34,50 i will upload the code with results here please someone help me to find out the confusion matrix or explain me how to do it on my own thanks in advance.
Assuming you are creating the model predictions and have the targets you could use sklearn.metrics.confusion_matrix
to create the confusion matrix.
Install torchmetrics
and use the confusion_matrix function available there.
I have understood the confusion matrix but i have 48 class names and the test data is with 800 images so for my transfer learning computer vision code i have given the num of images predicted as 6. iam confused now about how I can predict the true labels and predicted labels with it . my predicted images are 6 in these total 800 images how can i find out. if you can check the code and any idea from your side would be helpful thanks
Usually you would not compute a confusion matrix for a single batch output, but would store the predictions of e.g. the validation set and compute the confusion matrix for the entire validation set.