YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Pokémon Image Classification Model 🎮✨

This repository contains a deep learning-based Pokémon classification model trained on a diverse dataset of Pokémon images. The model leverages ResNet101 and is fine-tuned to identify Pokémon based on their images.


Features 🐾

  • High Accuracy: Achieves a test accuracy of 91.35%! 🎉
  • Supports 208 Pokémon classes! 🛡️🗡️

Performance Metrics 📊

Final Results:

  • Test Accuracy: 91.35%
  • Validation Accuracy: 86.89%
  • Training Accuracy: 99.89%

Confusion Matrix Visualization 🎯

Confusion Matrix

This confusion matrix gives a detailed view of the classification performance for each Pokémon class. Misclassifications are represented along the off-diagonal cells.


Dataset 📂

  • Source: Pokémon images dataset curated from various resources.
  • Structure:
    • images/: Contains all Pokémon images.
    • pokemon.csv: Metadata linking each image to its respective Pokémon and class labels.

Model Details 🧠

  • Architecture: Fine-tuned ResNet101.
  • Optimizer: Adam with learning rate scheduling.
  • Loss Function: Cross-Entropy Loss.

Usage 🚀

Loading the Model

import torch
from torchvision import models
import pickle

# Load the model
model = models.resnet101()
num_features = model.fc.in_features
model.fc = torch.nn.Linear(num_features, 208)  # Update for Pokémon classes
model.load_state_dict(torch.load('pokemon_model_best.pth'))
model.eval()

# Load label mapping
with open('label_mapping.pkl', 'rb') as f:
    label_mapping = pickle.load(f)

Making Predictions

from PIL import Image
from torchvision import transforms

# Define transforms
val_transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
])

# Load image
image = Image.open('path/to/image.png').convert('RGB')
input_tensor = val_transform(image).unsqueeze(0)

# Predict
with torch.no_grad():
    output = model(input_tensor)
    _, predicted_class = torch.max(output, 1)

# Map prediction to label
idx_to_name = {v: k for k, v in label_mapping.items()}
predicted_name = idx_to_name[predicted_class.item()]
print(f"Predicted Pokémon: {predicted_name}")

Feel free to explore and use the model. Contributions are welcome! 🙌

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including meryembarkallah21/Poke