I have tried doing this challenge using SVM. I dont know why but I am getting an error in predicting the final output as I am getting same pokemon name for all test images. I tried to figure the error but was not able to find any. Please help me . The link to my code is - https://drive.google.com/file/d/17kh3he1QR_cx5wRvXFSW4xy_qJU9YRhE/view?usp=sharing . I have first written the code for neural netword method and then svm method. Please check for svm as I have not done neural one complete.
Facing Problem in Pokemon Goa Trip Challenge
Hey @abhaygarg2001, i made a little changes, first of all your way of reading data is wrong there are 427 in images folder and you can’t directly read all images using p.glob(*)function. Here is what i suggest you to use for reading images,
data=pd.read_csv("train.csv").values
p="Images/"
# dirs=p.glob("*.jpg")
image_data=[]
label_dict={"Pikachu":0,"Bulbasaur":1,"Charmander":2}
label2pokemon={0:"Pikachu",1:"Bulbasaur",2:"Charmander"}
labels = []
for ix in tqdm(range(data.shape[0])):
img_path = p + data[ix][0]
labels.append(label_dict[data[ix][1]])
# print(img_path)
img=image.load_img(img_path,target_size=(40,40))
img_array=image.img_to_array(img)
image_data.append(img_array)
Also try to visualize loss function for all svm classifiers you made, you will see the loss is not decreasing and there are lot of fluctuations, so this suggest us that learning rate is high, I decreased the learning_rate to 0.00001. And got smoother results.
Hope this will resolve your doubt.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.