π₯ VeggieNet: Vegetable Image Classifier
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.
π§ Model Architecture
The network takes 128x128 RGB images and passes them through the following layers:
nn.Sequential(
nn.Flatten(),
nn.Linear(3 * 128 * 128, 512),
nn.BatchNorm1d(512),
nn.ReLU(),
nn.Dropout(0.3),
nn.Linear(512, 256),
nn.BatchNorm1d(256),
nn.ReLU(),
nn.Dropout(0.3),
nn.Linear(256, 128),
nn.BatchNorm1d(128),
nn.ReLU(),
nn.Dropout(0.3),
nn.Linear(128, num_classes)
)
- Loss Function:
CrossEntropyLoss
- Optimizer:
Adam
- Input Size:
3x128x128
- Output:
num_classes
(one per vegetable category)
π Dataset
This model is trained on a custom dataset from kaggle of vegetable images organized into:
vegetables_dataset/
βββ train/
βββ val/
βββ test/
Each subfolder represents a vegetable class (e.g., carrot/
, tomato/
, etc.). To download Click Here
π Training & Evaluation
- Trained for 10 epochs
- Batch size: 16
- Includes validation + test evaluation
- Final accuracy on test set: ~91.63%
- Confusion matrix is included in the evaluation
β Intended Use
- Educational projects
- Computer vision experiments
- Simple food classification tasks
π« Limitations
- Not robust to background noise or very similar vegetables
- May underperform on unseen real-world data if distribution differs
π‘ Future Improvements
- Replace FC layers with a CNN for better spatial feature learning
- Use transfer learning (e.g., ResNet18)
- Increase dataset diversity and quantity
π License
This model is available under the Apache-2.0 License.
βοΈ Author
- Created by: Arun Arunisto
- GitHub: arun-arunisto
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API:
The model has no library tag.
Evaluation results
- accuracy on Custom Vegetable Datasetself-reported91.63%
- confusion_matrix on Custom Vegetable Datasetself-reportedincluded