Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# EfficientNet-B0 Fruit & Vegetable Classifier ππ₯π½
|
| 3 |
+
|
| 4 |
+
This model classifies images of fruits and vegetables into multiple categories.
|
| 5 |
+
It is trained on the [Fruit and Vegetable Image Recognition dataset](https://www.kaggle.com/datasets/kritikseth/fruit-and-vegetable-image-recognition).
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## π Dataset Statistics
|
| 10 |
+
- Training Images: 3115
|
| 11 |
+
- Validation Images: 351
|
| 12 |
+
- Test Images: 359
|
| 13 |
+
- Classes: 36 β ['apple', 'banana', 'beetroot', 'bell pepper', 'cabbage', 'capsicum', 'carrot', 'cauliflower', 'chilli pepper', 'corn', 'cucumber', 'eggplant', 'garlic', 'ginger', 'grapes', 'jalepeno', 'kiwi', 'lemon', 'lettuce', 'mango', 'onion', 'orange', 'paprika', 'pear', 'peas', 'pineapple', 'pomegranate', 'potato', 'raddish', 'soy beans', 'spinach', 'sweetcorn', 'sweetpotato', 'tomato', 'turnip', 'watermelon']
|
| 14 |
+
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## π Results
|
| 18 |
+
- Final Training Accuracy: 72.50%
|
| 19 |
+
- Final Validation Accuracy: 87.75%
|
| 20 |
+
- Final Test Accuracy: 87.47%
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## π Usage
|
| 25 |
+
```python
|
| 26 |
+
import torch
|
| 27 |
+
from torchvision import models
|
| 28 |
+
|
| 29 |
+
# Load model
|
| 30 |
+
model = models.efficientnet_b0(pretrained=False)
|
| 31 |
+
num_features = model.classifier[1].in_features
|
| 32 |
+
model.classifier = torch.nn.Sequential(
|
| 33 |
+
torch.nn.Dropout(0.3),
|
| 34 |
+
torch.nn.Linear(num_features, 36)
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
# Load weights
|
| 38 |
+
model.load_state_dict(torch.load("pytorch_model.bin", map_location="cpu"))
|
| 39 |
+
model.eval()
|