File size: 1,987 Bytes
1d8aeab
 
137ced3
1d8aeab
 
 
 
 
 
 
 
137ced3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
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:
   ```bash
   pip install -r requirements.txt
   ```
3. Place your trained model weights as `model_best.pth.tar` in the root directory
4. Run the application:
   ```bash
   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

- [GitHub Repository](https://github.com/dhairyag/ImageNet1k_ResNet50)
- [Hugging Face Space](https://huggingface.co/spaces/dhairyashil/ImageNet1k)