Machine Learning · CNN Image Classification

Pokémon Image Classifier

A convolutional neural network trained to identify four Pokémon species from images achieving 88–96% accuracy using TensorFlow, Keras, and a custom preprocessed dataset.

Introduction

For our final Machine Learning course assignment, the team and I set out to combine the world of Pokemon with the power of Convolutional Neural Networks. The goal: build an image recognition system capable of distinguishing between four unique Pokemon species with high accuracy.

CNNs are well-suited for image classification tasks due to their ability to learn spatial hierarchies of features, making them a natural fit for differentiating visually distinct (and sometimes surprisingly similar) Pokémon.

The four Pokémon used in the classifier

The four Pokémon species selected for classification

Tools & Technologies

TensorFlow / Keras

CNN model implementation

Scikit-learn

Train/test split & metrics

OpenCV & NumPy

Image preprocessing

Matplotlib

Results visualization

Google Colab

Development environment

Kaggle

Image dataset hosting

Setup & Methodology

For each Pokémon we collected between 270 and 370 images sourced online, uploaded to Kaggle, and imported into Google Colab. The dataset was split 80/20 into training and testing samples, with pixel values normalized by dividing by 255.

The model architecture was the most time-intensive part, requiring multiple iterations to find the right number of layers for optimal accuracy without overfitting. We settled on a 7-layer CNN, trained for up to 15 epochs with early stopping when accuracy began to decline.

Model Architecture (7 Layers)

01

Conv2D ×2

Detect subtle visual features with increasing depth

02

MaxPooling2D ×2

Extract the most prominent features from pixel arrays

03

Dense ×2

Classify images using convolutional output

04

Dropout

Prevent overfitting during training

Results

~96%

Peak test accuracy

88–96%

Accuracy across runs

4

Pokémon species classified

The most common misclassification was Charmander being identified as Pikachu, likely due to shared visual traits like a tail and similar warm skin tones. The confusion matrix and epoch graph below illustrate the model's performance in detail.

Confusion matrix showing classification results

Confusion matrix

Model accuracy across training epochs

Accuracy across epochs

Conclusion

This project demonstrates that a CNN can reliably classify Pokémon images with high accuracy as long as the species don't share too many visual similarities. The 88–96% accuracy range held consistent across multiple runs with different dataset samples.

Future improvements would include expanding to more Pokémon species, increasing image count and quality per class, and experimenting with transfer learning using pretrained models like ResNet or MobileNet for even higher accuracy.