获取 SVM 错误预测的图像名称
machine-learning 522
原文标题 :Getting Name of Images at which SVM mispredicted
我正在研究二进制分类模型,我想知道模型错误预测的图像的名称。我该怎么做?
to_be_moved = random.sample(glob.glob("/content/COVID-19_Radiography_Dataset/COVID/images/*.png"), 1500)
label= 0
for img in tqdm(to_be_moved):
imgstate= cv2.imread(img,0)
resizedimage=cv2.resize(imgstate,(220,220))
fd = hog(resizedimage, orientations=9, pixels_per_cell=(2, 2),cells_per_block=(1,1), visualize=False, multichannel=False)
data.append([fd,label])
random.shuffle(data)
features= []
labels=[]
for feature , label in data :
features.append(feature)
labels.append(label)
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
X_train , X_test , y_train , y_test = train_test_split(features,labels, test_size=0.25)
model = SVC(C=1,kernel='linear',gamma ='auto' )
model.fit(X_train , y_train)