I have a pre trained image classification model and I'm feeding it new images. I can get a prediction just fine, but how can I get the accuracy of this prediction or is this even possible? Below is what I'm trying to accomplish. I checked sklearn but couldn't find anything relevant. the img will be (80,80) and will be reshaped to (1,6400) for the protection.
def f(img):
filename = "SVM_model.sav"
with open(filename, 'rb') as file1:
SV = pickle.load(file1)
p = SV.predict(img)
accuracy = ????
return p and accuracy
CodePudding user response:
To have the accuracy, you need to have the real class of your predictions. I think that you rather want to know how confident you are in the prediction. For that, you can use the method SV.predict_proba(img)
instead of SV.predict(img)