I have built a model and validate it in the validation set. Now I want to check its performance on the test set (I have 10 subfolders each subfolder name means the label for that group of images) How can I do that and compute the accuracy for it?
Note: I have my test set folder created in the data bunch already as in the following code:
data = (ImageItemList.from_folder(path)
.split_by_folder()
.label_from_folder()
.add_test_folder(’./test’)
.transform(tfms=no_augumentation, size=224)
.databunch(bs=bs)).normalize(imagenet_stats)
I believe you will have to pre-process your data a little. Add all the images in a folder called test. Add this test set to your data bunch like you have already done. Then you can run the following line of code to make predictions on it:
preds,_ = learn.get_preds(ds_type=DatasetType.Test)
Use these predictions to calculate the accuracy. For this maybe you can create a csv with image names, actual targets and predicted targets. Work around a little, write short scripts for doing these things and you will be fine.
thanks @heye0507 for the suggestion I tried to do that but when it comes to show the confusion matrix it returns the one belong to the real validation set not the test set.