π½ Dish Image Verification Model
This model verifies whether a given image matches a provided dish name.
It has been trained on a curated dataset of food images and labels, optimized for high precision in dish recognition tasks.
π Model Details
- Architecture: ResNet / CNN-based (PyTorch)
- Training Type: Fine-tuning on custom dataset
- Framework: PyTorch
- Task: Image classification (verification)
- Input: An image of a dish
- Output: Probability of the image matching the given dish name (True/False)
π Performance
| Metric | Score |
|---|---|
| Precision (p) | 99.55% |
| Recall (r) | 99.10% |
| F1-score (f1) | 99.33% |
| Epochs Trained | 15 |
| Device | CUDA (GPU) |
Example from training:
Epoch 15: p=0.9955 r=0.9910 f1=0.9932 time=65.3s
π Dataset
- Type: Custom dataset with dish images and dish names.
- Structure:
train/β Training imagesval/β Validation images
- Images are labeled according to dish names and mapped to verification labels.
π How to Use
from PIL import Image
import torch
from torchvision import transforms
from model import DishVerificationModel # your model class
# Load model
model = DishVerificationModel()
model.load_state_dict(torch.load("base.pth", map_location="cpu"))
model.eval()
# Preprocess image
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor()
])
img = Image.open("test_dish.jpg")
img_tensor = transform(img).unsqueeze(0)
# Predict
with torch.no_grad():
output = model(img_tensor)
prediction = torch.sigmoid(output).item()
print("Match:", prediction > 0.5)
π§ͺ Example Use Cases
- Restaurant apps verifying menu images
- Food delivery services detecting incorrect uploads
- Dish tagging automation
β οΈ Limitations
- May misclassify visually similar dishes.
- Works best with clear, high-quality images.
π License
This model is released under the Apache 2.0 License.
β¨ Citation
If you use this model, please cite:
@software{dish_verification_2025,
title = {Dish Image Verification Model},
author = {Vamsee},
year = {2025},
url = {https://huggingface.co/vamsee99/food-vs-notfood-model}
}