Delete README.md
Browse files
README.md
DELETED
|
@@ -1,140 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
library_name: pytorch
|
| 3 |
-
tags:
|
| 4 |
-
- image-classification
|
| 5 |
-
- pytorch
|
| 6 |
-
- efficientnet
|
| 7 |
-
- flowers
|
| 8 |
-
- computer-vision
|
| 9 |
-
- oxford-flowers-102
|
| 10 |
-
- vision
|
| 11 |
-
pipeline_tag: image-classification
|
| 12 |
-
datasets:
|
| 13 |
-
- dpdl-benchmark/oxford_flowers102
|
| 14 |
-
license: mit
|
| 15 |
-
metrics:
|
| 16 |
-
- accuracy
|
| 17 |
-
base_model: efficientnet
|
| 18 |
-
language:
|
| 19 |
-
- en
|
| 20 |
-
---
|
| 21 |
-
|
| 22 |
-
# 🌸 Flower Classification Model
|
| 23 |
-
|
| 24 |
-
## 📊 Model Info
|
| 25 |
-
|
| 26 |
-
[](https://huggingface.co/nailarais1/image-classifier-efficientnet)
|
| 27 |
-
[](LICENSE)
|
| 28 |
-
[](https://pytorch.org)
|
| 29 |
-
[](https://huggingface.co/nailarais1/image-classifier-efficientnet)
|
| 30 |
-
|
| 31 |
-
Model: nailarais1/image-classifier-efficientnet
|
| 32 |
-
Author: Naila Rais
|
| 33 |
-
Task: Image Classification · 102 Flower Species
|
| 34 |
-
|
| 35 |
-
## Quick Start
|
| 36 |
-
|
| 37 |
-
### Installation
|
| 38 |
-
|
| 39 |
-
```bash
|
| 40 |
-
pip install torch torchvision pillow
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
### Basic Usage
|
| 44 |
-
|
| 45 |
-
```python
|
| 46 |
-
import torch
|
| 47 |
-
import torchvision.transforms as transforms
|
| 48 |
-
from PIL import Image
|
| 49 |
-
|
| 50 |
-
# Load model
|
| 51 |
-
checkpoint = torch.load('best_model.pth', map_location='cpu')
|
| 52 |
-
model = ... # Your model architecture
|
| 53 |
-
model.load_state_dict(checkpoint['model_state_dict'])
|
| 54 |
-
model.eval()
|
| 55 |
-
|
| 56 |
-
# Predict flower
|
| 57 |
-
def predict_flower(image_path):
|
| 58 |
-
transform = transforms.Compose([
|
| 59 |
-
transforms.Resize(256),
|
| 60 |
-
transforms.CenterCrop(224),
|
| 61 |
-
transforms.ToTensor(),
|
| 62 |
-
transforms.Normalize(mean=[0.485, 0.456, 0.406],
|
| 63 |
-
std=[0.229, 0.224, 0.225])
|
| 64 |
-
])
|
| 65 |
-
|
| 66 |
-
image = Image.open(image_path).convert('RGB')
|
| 67 |
-
image_tensor = transform(image).unsqueeze(0)
|
| 68 |
-
|
| 69 |
-
with torch.no_grad():
|
| 70 |
-
outputs = model(image_tensor)
|
| 71 |
-
_, predicted = torch.max(outputs, 1)
|
| 72 |
-
|
| 73 |
-
return predicted.item()
|
| 74 |
-
|
| 75 |
-
# Get flower name
|
| 76 |
-
flower_id = predict_flower('your_flower.jpg')
|
| 77 |
-
flower_name = class_names[flower_id] # Use class_config.json
|
| 78 |
-
print(f"Predicted: {flower_name}")
|
| 79 |
-
```
|
| 80 |
-
|
| 81 |
-
### Model Info
|
| 82 |
-
|
| 83 |
-
- **What it does:** Identifies 102 different flower species
|
| 84 |
-
- **Input:** Flower images (224×224 pixels)
|
| 85 |
-
- **Output:** Flower name and confidence score
|
| 86 |
-
- **Architecture:** EfficientNet
|
| 87 |
-
- **Training:** 3 epochs on Oxford Flowers dataset
|
| 88 |
-
|
| 89 |
-
### Example Results
|
| 90 |
-
|
| 91 |
-
- 🌹 Input: rose_image.jpg → Output: "rose" (98.2%)
|
| 92 |
-
- 🌻 Input: sunflower.jpg → Output: "sunflower" (95.7%)
|
| 93 |
-
- 🌷 Input: tulip.jpg → Output: "tulip" (92.3%)
|
| 94 |
-
|
| 95 |
-
### Files Included
|
| 96 |
-
|
| 97 |
-
- best_model.pth - Trained model weights
|
| 98 |
-
- class_config.json - Flower names mapping
|
| 99 |
-
- config.json - Model configuration
|
| 100 |
-
- labels.txt - List of all flower names
|
| 101 |
-
|
| 102 |
-
### Supported Flowers
|
| 103 |
-
|
| 104 |
-
102 species including:
|
| 105 |
-
- 🌹 Rose
|
| 106 |
-
- 🌻 Sunflower
|
| 107 |
-
- 🌷 Tulip
|
| 108 |
-
- 🌼 Daisy
|
| 109 |
-
- 💐 Lily
|
| 110 |
-
- 🏵️ Orchid
|
| 111 |
-
- 🌺 Hibiscus
|
| 112 |
-
- 🌸 Cherry Blossom
|
| 113 |
-
- And 94 more...
|
| 114 |
-
|
| 115 |
-
## For Developers
|
| 116 |
-
|
| 117 |
-
```python
|
| 118 |
-
# Get top-5 predictions
|
| 119 |
-
def top_k_predictions(image_path, k=5):
|
| 120 |
-
# ... (implementation)
|
| 121 |
-
return [
|
| 122 |
-
{"flower": "rose", "confidence": 0.98},
|
| 123 |
-
{"flower": "tulip", "confidence": 0.01},
|
| 124 |
-
# ...
|
| 125 |
-
]
|
| 126 |
-
```
|
| 127 |
-
|
| 128 |
-
### License
|
| 129 |
-
|
| 130 |
-
MIT License - Free for personal and commercial use ✅
|
| 131 |
-
|
| 132 |
-
### Need Help?
|
| 133 |
-
|
| 134 |
-
- Model not loading? Check PyTorch version
|
| 135 |
-
- Wrong predictions? Use clear, centered flower images
|
| 136 |
-
- Other issues? Open a discussion on this repo
|
| 137 |
-
|
| 138 |
-
Download and start classifying flowers today! 🌸
|
| 139 |
-
|
| 140 |
-
Model by Naila Rais · Hosted on Hugging Face
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|