File size: 1,951 Bytes
4c54cfc
 
 
 
 
 
49a58a2
4c54cfc
 
 
 
077fb0c
 
aa6486e
077fb0c
aa6486e
077fb0c
aa6486e
 
 
 
 
 
077fb0c
aa6486e
077fb0c
aa6486e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
077fb0c
 
aa6486e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149d670
 
 
 
 
 
 
 
 
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
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