ImageNet1k / README.md
dhairyashil's picture
add gradio app demo
137ced3

A newer version of the Gradio SDK is available: 6.6.0

Upgrade
metadata
title: ImageNet1k
emoji: πŸš€ 🌟
colorFrom: red
colorTo: gray
sdk: gradio
sdk_version: 5.9.1
app_file: app.py
pinned: false

ImageNet1k Classification Demo

This is a Gradio web application that demonstrates image classification using a ResNet50 model trained on the ImageNet1k dataset. The model can classify images into 1000 different categories.

Features

  • Upload and classify any image
  • Get top 5 predictions with confidence scores
  • Real-time inference
  • User-friendly interface
  • Example images included

Technical Details

Model Architecture

  • Base Model: ResNet50
  • Training Dataset: ImageNet1k (1000 classes)
  • Input Size: 224x224 pixels
  • Preprocessing: Standard ImageNet normalization (mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])

Dependencies

  • gradio: Web interface framework
  • torch: PyTorch deep learning framework
  • torchvision: Computer vision utilities
  • Pillow: Image processing

Usage

  1. Upload an image using the interface
  2. The model will process the image and return:
    • Top 5 predicted classes
    • Confidence scores for each prediction

Tips for Best Results

  • Use clear, well-lit images
  • Ensure the main subject is centered and clearly visible
  • The model works best with common objects, animals, and scenes
  • Both color and black & white images are supported
  • Images will be automatically resized to 224x224

Local Setup

  1. Clone the repository
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. Place your trained model weights as model_best.pth.tar in the root directory
  4. Run the application:
    python app.py
    

Model Weights

The model weights (model_best.pth.tar) should be placed in the same directory as app.py. The weights file contains a ResNet50 model trained on ImageNet1k.

Links