ImageNet / README.md
Shilpaj's picture
Docs: Updated docs
149d670

A newer version of the Gradio SDK is available: 5.42.0

Upgrade
metadata
title: ResNet50 ImageNet Classifier
emoji: πŸ–ΌοΈ
colorFrom: blue
colorTo: red
sdk: gradio
sdk_version: 5.9.1
app_file: app.py
pinned: false

ResNet50 trained on ImageNet-1K

This is a ResNet50 model trained on ImageNet-1K dataset with 1000 classes. The model can classify a wide variety of images into 1000 different categories.

Model Details

  • Architecture: ResNet50
  • Dataset: ImageNet-1K
  • Classes: 1000
  • Input Size: 224x224 pixels
  • Model File: resnet50_imagenet1k.pth
  • Training Repository: Link

Quick Start

  1. Clone the repository:
git clone https://huggingface.co/spaces/Shilpaj/ImageNet
cd ImageNet
  1. Download the model:
# Option 1: Using wget
wget https://huggingface.co/spaces/Shilpaj/ImageNet/blob/main/resnet50_imagenet1k.pth

# Option 2: Manual download
Download from: https://huggingface.co/spaces/Shilpaj/ImageNet/tree/main/resnet50_imagenet1k.pth
  1. Install requirements:
pip install -r requirements.txt
  1. Run the demo:
python app.py

Usage in Your Project

from inference import ImageNetClassifier

# Initialize the classifier
classifier = ImageNetClassifier('resnet50_imagenet1k.pth')

# Classify an image
image_path = 'path/to/your/image.jpg'
prediction, confidence = classifier.predict(image_path)
print(f"Prediction: {prediction}")
print(f"Confidence: {confidence:.2f}%")

Example Images

The assets/examples directory contains sample images for testing:

  • Bird
  • Car
  • Cat
  • Dog
  • Frog
  • Horse
  • Plane
  • Ship
  • Truck

Repository Structure

.
β”œβ”€β”€ app.py              # Gradio web interface
β”œβ”€β”€ inference.py        # Model inference code
β”œβ”€β”€ requirements.txt    # Python dependencies
└── assets/
    └── examples/      # Example images for testing

License

MIT

Acknowledgments

  • ImageNet Dataset
  • PyTorch Team
  • HuggingFace Datasets