Messi vs Ronaldo Classifier

July 7, 2026

Messi vs Ronaldo Image Classifier

A playful AI project that trains a neural network to tell whether a soccer image shows Lionel Messi or Cristiano Ronaldo.

This is an AI-related image classification project built for a university assignment, with dataset analysis, model training, and notebook documentation.

Messi vs Ronaldo

Project overview

This project uses a neural network to learn from labeled soccer images and classify whether the picture belongs to Messi or Ronaldo. The notebook includes data exploration, preprocessing, training, and inference.

Key AI concepts

  1. Machine Learning (ML)
    • Train the model using labeled data so it learns to classify images without explicit rules.
  2. Neural Networks (NN)
    • Use connected layers of neurons to extract visual patterns from images.
  3. Deep Learning
    • Build a multi-layer network that captures complex features like faces, poses, and jerseys.
  4. Supervised Learning
    • Train on labeled Messi and Ronaldo images so the network learns the correct labels.
  5. Unsupervised Learning
    • Optional analysis can include clustering image features to see how Messi and Ronaldo images group.
  6. Reinforcement Learning
    • Not used directly here, but the project is part of a broader AI learning path.

Project structure

  • data/: Contains the image dataset used for training and validation.
  • models/: Stores saved model files and weights.
  • messi_ronaldo.ipynb: Primary Jupyter Notebook with code and explanations.

Steps to complete the project

  1. Introduction
    • Define the classification task and dataset.
    • Explain why Messi and Ronaldo make a fun, human-friendly dataset.
  2. Dataset analysis
    • Review class distribution for Messi vs Ronaldo.
    • Display sample images from each class.
  3. Data preprocessing
    • Resize and normalize images.
    • Split data into training, validation, and test sets.
    • Apply data augmentation to improve generalization.
  4. Model training
    • Choose a neural network architecture.
    • Define metrics like accuracy and loss.
    • Run experiments with learning rate, batch size, and epochs.
  5. Inference
    • Predict new images.
    • Evaluate model performance on held-out data.

Documentation

The notebook contains friendly explanations for every step, including:

  • dataset structure and sample images
  • preprocessing pipeline
  • model definition and training
  • results visualization
  • final conclusions

Messi and Ronaldo

Getting started

  1. Clone the repository.
  2. Install dependencies.
  3. Open messi_ronaldo.ipynb.
  4. Run the notebook cells and follow the guided analysis.

Source code

View the Neural Network Classification source on GitHub

How to run

git clone https://github.com/tothantonio/neural-network-classification.git
cd neural-network-classification
pip install -r requirements.txt
jupyter notebook messi_ronaldo.ipynb

Conclusion

This project is a fun, beginner-friendly AI application that shows how neural networks can classify images of two famous football stars. It is a great way to learn real AI practices while keeping the project entertaining.