Spaces:
Sleeping
Sleeping
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](https://github.com/pradeep6kumar/ImageNet_v4) | |
## Quick Start | |
1. Clone the repository: | |
```bash | |
git clone https://huggingface.co/spaces/Shilpaj/ImageNet | |
cd ImageNet | |
``` | |
2. Download the model: | |
```bash | |
# 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 | |
``` | |
3. Install requirements: | |
```bash | |
pip install -r requirements.txt | |
``` | |
4. Run the demo: | |
```bash | |
python app.py | |
``` | |
## Usage in Your Project | |
```python | |
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 | |