Skip to content

OsmanByrm/Gym-Equipment-Classification-with-PyTorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation


🏋️‍♂️ Gym Equipment Classification with PyTorch

Welcome to the Gym Equipment Classification project! This project combines deep learning with fitness, using images of gym equipment to train a model that can automatically recognize different types of gear. Built with the power of PyTorch and some serious data magic, this classifier can help in applications like fitness apps to recommend workouts based on recognized equipment!

image

Kaggle

🚀 Overview

Check out this project on my Kaggle profile! I regularly share machine learning and deep learning projects there, and this one is dedicated to improving how we classify gym equipment. In this project, we go from data preprocessing to model training and all the way to evaluation. Each step is crafted to make the classifier as accurate and generalizable as possible.

Key Stages:

  1. Data Preprocessing: A sprinkle of augmentation and normalization.
  2. Model Selection: ResNet18 takes center stage with some fine-tuning for our needs.
  3. Training and Evaluation: Running the model on the dataset to learn and track performance.
  4. Sample Predictions: Showcasing some real-world predictions from the model.

🏋️‍♂️ Dataset

The dataset includes images of gym equipment, organized into:

  • train: Training data with various types of equipment.
  • valid: Validation data to test the model's learning progress.
  • test: Final test data for evaluating real-world accuracy.

Equipment categories include dumbbells, elliptical machines, home machines, recumbent bikes, and more. Data augmentation techniques like random horizontal flips and rotations make our model stronger and more robust.

🛠️ Requirements

To get this notebook running, you’ll need:

  • torch and torchvision: The core libraries for building and training deep learning models.
  • matplotlib and numpy: Visualization and numerical processing libraries.
  • seaborn and scikit-learn: For our friendly evaluation metrics.

Install everything with:

pip install torch torchvision matplotlib numpy seaborn scikit-learn

🧠 Model Architecture

The heart of our classifier is ResNet18, chosen for its great balance between efficiency and accuracy. The model’s final layer has been fine-tuned to classify different gym equipment categories based on the images in our dataset.

🔍 Code Structure

Here's what you can expect in the code:

  • Data Loading and Visualization: Loads and visualizes samples from the dataset.
  • Data Preprocessing: Applies transformations to boost performance.
  • Model Selection: Loads and customizes ResNet18 for our needs.
  • Train Model: Runs the training loop and tracks progress.
  • Evaluate Model: Evaluates accuracy and shows a confusion matrix.
  • Sample Predictions: Visualizes some predictions to see how the model performs.

📊 Training and Evaluation

The model is trained in a few steps:

  1. Data Augmentation: Adds variety to our training data.
  2. Training Loop: Batches data, optimizes with Adam, and learns!
  3. Validation: Checks model’s performance after each epoch.

Performance

We measure performance with:

  • Validation Accuracy: How accurately the model classifies validation images.
  • Confusion Matrix: Shows the model’s strengths and weaknesses for each category.

Sample predictions are included for a real-world test!

🎉 Results

Our validation accuracy hits approximately X% (insert the real number after testing). The confusion matrix reveals which categories the model occasionally mixes up. Overall, it’s a great start and can be expanded further.

🌱 Future Work

For the next steps:

  • Expanding the Dataset: Adding more images or new categories.
  • Testing Other Architectures: Trying more complex models like ResNet50.
  • Hyperparameter Tuning: Adjusting settings to fine-tune performance.

🛠️ Usage

To try it out yourself:

  1. Clone the repository:

    git clone https://github.com/yourusername/GymEquipmentClassification.git
    cd GymEquipmentClassification
  2. Organize the dataset into the correct structure (train/valid/test folders).

  3. Run the Jupyter notebook or Python script to begin training!

📜 Acknowledgments

Thanks to the amazing communities at PyTorch and Kaggle for tools, resources, and inspiration! This project aims to make gym equipment recognition easier for fitness apps and personal trainers.

Explore more of my projects on Kaggle. I’m always excited to share my progress and see what others are building too!


This README brings a friendly, engaging tone and includes the Kaggle logo with a link to your profile for more exposure. Let me know if there’s anything else you’d like to tweak!

About

Gym Equipment Classification with PyTorch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published