Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,107 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- image-classification
|
5 |
+
- computer-vision
|
6 |
+
- vegetables
|
7 |
+
- pytorch
|
8 |
+
- food
|
9 |
+
datasets:
|
10 |
+
- Custom
|
11 |
+
metrics:
|
12 |
+
- accuracy
|
13 |
+
- confusion_matrix
|
14 |
+
model-index:
|
15 |
+
- name: VeggieNet
|
16 |
+
results:
|
17 |
+
- task:
|
18 |
+
type: image-classification
|
19 |
+
name: Image Classification
|
20 |
+
dataset:
|
21 |
+
name: Custom Vegetable Dataset
|
22 |
+
type: image
|
23 |
+
metrics:
|
24 |
+
- type: accuracy
|
25 |
+
value: 91.63%
|
26 |
+
- type: confusion_matrix
|
27 |
+
value: included
|
28 |
+
---
|
29 |
+
|
30 |
+
# π₯ VeggieNet: Vegetable Image Classifier
|
31 |
+
|
32 |
+
**VeggieNet** is a deep learning model trained in PyTorch for classifying vegetable images into categories like tomato, carrot, potato, etc. It uses a fully connected neural network with regularization (BatchNorm and Dropout) to prevent overfitting and improve generalization.
|
33 |
+
|
34 |
+
## π§ Model Architecture
|
35 |
+
|
36 |
+
The network takes 128x128 RGB images and passes them through the following layers:
|
37 |
+
|
38 |
+
```python
|
39 |
+
nn.Sequential(
|
40 |
+
nn.Flatten(),
|
41 |
+
nn.Linear(3 * 128 * 128, 512),
|
42 |
+
nn.BatchNorm1d(512),
|
43 |
+
nn.ReLU(),
|
44 |
+
nn.Dropout(0.3),
|
45 |
+
nn.Linear(512, 256),
|
46 |
+
nn.BatchNorm1d(256),
|
47 |
+
nn.ReLU(),
|
48 |
+
nn.Dropout(0.3),
|
49 |
+
nn.Linear(256, 128),
|
50 |
+
nn.BatchNorm1d(128),
|
51 |
+
nn.ReLU(),
|
52 |
+
nn.Dropout(0.3),
|
53 |
+
nn.Linear(128, num_classes)
|
54 |
+
)
|
55 |
+
```
|
56 |
+
|
57 |
+
- **Loss Function**: `CrossEntropyLoss`
|
58 |
+
- **Optimizer**: `Adam`
|
59 |
+
- **Input Size**: `3x128x128`
|
60 |
+
- **Output**: `num_classes` (one per vegetable category)
|
61 |
+
|
62 |
+
## π Dataset
|
63 |
+
|
64 |
+
This model is trained on a custom dataset from kaggle of vegetable images organized into:
|
65 |
+
|
66 |
+
```
|
67 |
+
vegetables_dataset/
|
68 |
+
βββ train/
|
69 |
+
βββ val/
|
70 |
+
βββ test/
|
71 |
+
```
|
72 |
+
|
73 |
+
Each subfolder represents a vegetable class (e.g., `carrot/`, `tomato/`, etc.). To download [Click Here](https://www.kaggle.com/datasets/misrakahmed/vegetable-image-dataset?select=Vegetable+Images)
|
74 |
+
|
75 |
+
## π Training & Evaluation
|
76 |
+
|
77 |
+
- Trained for **10 epochs**
|
78 |
+
- Batch size: 16
|
79 |
+
- Includes validation + test evaluation
|
80 |
+
- Final accuracy on test set: **~91.63%**
|
81 |
+
- Confusion matrix is included in the evaluation
|
82 |
+
|
83 |
+
## β
Intended Use
|
84 |
+
|
85 |
+
- Educational projects
|
86 |
+
- Computer vision experiments
|
87 |
+
- Simple food classification tasks
|
88 |
+
|
89 |
+
## π« Limitations
|
90 |
+
|
91 |
+
- Not robust to background noise or very similar vegetables
|
92 |
+
- May underperform on unseen real-world data if distribution differs
|
93 |
+
|
94 |
+
## π‘ Future Improvements
|
95 |
+
|
96 |
+
- Replace FC layers with a CNN for better spatial feature learning
|
97 |
+
- Use transfer learning (e.g., ResNet18)
|
98 |
+
- Increase dataset diversity and quantity
|
99 |
+
|
100 |
+
## π License
|
101 |
+
|
102 |
+
This model is available under the **Apache-2.0 License**.
|
103 |
+
|
104 |
+
## βοΈ Author
|
105 |
+
|
106 |
+
- Created by: *Arun Arunisto*
|
107 |
+
- GitHub: [arun-arunisto](https://github.com/arun-arunisto)
|