Skip to content

Tire condition classification using ResNet and transfer learning. This project applies deep learning to identify whether a tire is in good or bad condition based on image data.

License

Notifications You must be signed in to change notification settings

hurkanugur/ResNet-Tire-Classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛞 Tire Classification using Transfer Learning (ResNet50)

📖 Overview

This project predicts tire classes (e.g., damaged vs. normal) using Transfer Learning with a pretrained ResNet50 architecture from PyTorch. It demonstrates a modern deep learning pipeline including:

  • 🧠 Pretrained ResNet50 backbone from ImageNet for feature extraction
  • 🧩 Custom Fully Connected (FC) Classifier Head with Batch Normalization, ReLU, and Dropout
  • ⚖️ Cross-Entropy Loss for binary classification
  • 🚀 Adam optimizer for efficient training
  • 🔒 Frozen ResNet backbone to leverage pre-learned visual features
  • 🧰 Modular design — easily switch between saving only the FC head or the full model
  • 🎨 Interactive Gradio Interface for real-time image classification visualization

🖼️ Application Screenshot

Below is a preview of the Gradio Interface used for real-time classification:

Application Screenshot


🧩 Libraries

  • PyTorch – model, training, and inference
  • torchvision – pretrained ResNet50 weights
  • pandas, numpy – data handling
  • matplotlib – loss visualization
  • pickle – saving/loading normalization params and trained model
  • Gradio — interactive web interface for real-time model demos

⚙️ Requirements

  • Python 3.13+
  • Recommended editor: VS Code

📦 Installation

  • Clone the repository
git clone https://github.com/hurkanugur/ResNet-Tire-Classifier.git
  • Navigate to the ResNet-Tire-Classifier directory
cd ResNet-Tire-Classifier
  • Install dependencies
pip install -r requirements.txt

🔧 Setup Python Environment in VS Code

  1. View → Command Palette → Python: Create Environment
  2. Choose Venv and your Python version
  3. Select requirements.txt to install dependencies
  4. Click OK

🗂️ Download and Prepare Dataset

  1. Download Dataset: 🔗 Click here to download
  2. Unzip data.zip into the project directory
  3. The data folder should be on the same hierarchy as src and model.

📂 Project Structure

assets/
└── app_screenshot.png                # Screenshot of the application

data/
├── defective                         # Defective tire images
└── good                              # Good tire images

src/
├── config.py                         # Paths, hyperparameters, split ratios
├── dataset.py                        # Data loading & preprocessing
├── device_manager.py                 # Selects and manages compute device
├── train.py                          # Training pipeline
├── inference.py                      # Inference pipeline
├── model.py                          # Neural network definition
└── visualize.py                      # Training/validation plots

main/
├── main_train.py                     # Entry point for training
└── main_inference.py                 # Entry point for inference

requirements.txt                      # Python dependencies

📂 Model Architecture

ResNet50 (Pretrained on ImageNet)
  ↓
[Feature Extractor]                   # All convolutional layers (frozen)
  ↓
Custom Classifier Head:
  → Linear(in_features, 1024)
  → BatchNorm1d(1024)
  → ReLU
  → Dropout(0.5)
  → Linear(1024, 2)
  → Softmax(Output)

📂 Train the Model

Navigate to the project directory:

cd ResNet-Tire-Classifier

Run the training script:

python -m main.main_train

or

python3 -m main.main_train

📂 Run Inference / Make Predictions

Navigate to the project directory:

cd ResNet-Tire-Classifier

Run the app:

python -m main.main_inference

or

python3 -m main.main_inference

Releases

No releases published

Packages

No packages published

Languages