Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
5.42.0
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
- Clone the repository:
git clone https://huggingface.co/spaces/Shilpaj/ImageNet
cd ImageNet
- 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
- Install requirements:
pip install -r requirements.txt
- 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