CNN Image Processing: Pokemon Classifier

Introduction:

Welcome to the Pokémon Image Identifier project! In this machine learning endeavor, My team and I set out on an exciting journey to combine the captivating world of Pokémon with the cutting-edge power of Convolutional Neural Networks (CNNs). Our goal was to create a sophisticated image recognition system capable of identifying various Pokémon species from images with remarkable accuracy.



The Project:

This project was what our team which comprised of four people decided to do for our final assignment for our Machine Learning course. The goal of this recognition system was that it should be able to differeniate between 4 unique pokemon and classify them from just an image. The image below displays the different Pokemon we picked for this project.

Pokemon



Tools Utilized:

We used Google Colab as our code editor. The coding language was python since it has many useful libraries which utilize machine learning algorithms making it easy and efficient to train and test models. These libraries include: Tensorflow for its keras api which allowed us to implement the convolutional neural network, Sklearn for splitting the training and testing samples as well getting analytical data from the model such as the precision score. Cv2 and numpy to convert the images into a BGR color space array. Finally we used matplotlib to display the results. To get the images we found images of the pokemon online and uploaded them to kaggle and then later imported them to the google colab notebook workspace.



Set up and Methodology:

For each pokemon we prepared somewhere between 270 and 370 images which were then split into training and testing data with an 80-20 split. The in order tonormalize the pixel values we divided the array by 255(the range of possible pixel values). The next step was to create tehe convulutional neural network model. This was the part that took the most time as we had to go back and tweak the number of layers for optimal efficiency and accuracy. We decided to use a convolutional neural network due to its popularity with image calssification algorithms and calculation speed. The model cosistes of 7 layers in total. 2 conv2d with increasing layers to detect slight distinct features in the images, 2 maxpooling layers to detect the most intense features in the image from the pixel array generated by the conv2d layers, 2 Dense layers which use the convolutional layers' output to classify the images, and a dropout layer which prevents us from overfitting data. And finally we trained the model using the training samples with a max of 15 iterations (epochs) exiting when accuracy starts declining, and then the model tried to predict the testing samples.



Results:

We were able to achieve great accuracy from our model with the testing samples at around 91% accuracy, further testing of the same algorithm with different images used for the training and testing samples yielded similar accuracy (88%-92%). the most common misclassification as can be seen in the confusion matrix was that the model calssified Charmander images as Pikachu images, this is likely due to the fact that this pokemon have large similarities in their appearance such as a tail and similar skin colors.
Confusion Matrix
Model Epochs



Conclusion:

This project shows that a CNN can be used to reliantly identify pokemon images with high accuracy (as long as there are not too many glaring similarities between them). Future improvemnts to this project would be adding more different pokemon as well as increasing the image quality and the number of images used to give the model better training.