A Food image classification model fine-tuned on the Food-101 dataset using the powerful facebook/deit-base-patch16-224 architecture. This model classifies images into one of 101 popular food categories such as pizza, ramen, pad thai, sushi, and more.
๐ง Framework: Hugging Face Transformers + PyTorch
๐ง Intended Uses
โ Food image classification in apps/web
โ Educational visual datasets
โ Food blog/media categorization
โ Restaurant ordering support systems
๐ซ Limitations
โ May not perform well on poor-quality or mixed-food images
โ Not optimized for detecting multiple food items per image
๐๏ธโโ๏ธ Training Details
Attribute
Value
Base Model
facebook/deit-base-patch16-224
Dataset
Food-101-Dataset
Task Type
Image Classification
Epochs
3
Batch Size
16
Optimizer
AdamW
Loss Function
CrossEntropyLoss
Framework
PyTorch + Transformers
Hardware
CUDA-enabled GPU
๐ Evaluation Metrics
Metric
Score
Accuracy
0.97
F1-Score
0.98
Precision
0.99
Recall
0.97
๐ Usage
from transformers import AutoImageProcessor, AutoModelForImageClassification
from PIL import Image
import torch
from torchvision.transforms import Compose, Resize, ToTensor, Normalize
# Load model and processor
model_name = "AventIQ-AI/Food-Classification-AI-Model"
model = AutoModelForImageClassification.from_pretrained("your-model-path")
processor = AutoImageProcessor.from_pretrained("your-model-path")
defpredict(image_path):
device = torch.device("cuda"if torch.cuda.is_available() else"cpu")
model.to(device)
image = Image.open(image_path).convert("RGB")
transform = Compose([
Resize((224, 224)),
ToTensor(),
Normalize(mean=processor.image_mean, std=processor.image_std)
])
pixel_values = transform(image).unsqueeze(0).to(device)
with torch.no_grad():
outputs = model(pixel_values=pixel_values)
logits = outputs.logits
predicted_idx = logits.argmax(-1).item()
predicted_label = model.config.id2label[predicted_idx]
return predicted_label
# Example usage:print(predict("Foodexample.jpg"))
๐งฉ Quantization
Post-training static quantization applied using PyTorch to reduce model size and accelerate inference on edge devices.
๐ Repository Structure
.
beans-vit-finetuned/
โโโ config.json โ Model architecture & config
โโโ pytorch_model.bin โ Model weights
โโโ preprocessor_config.json โ Image processor config
โโโ training_args.bin โ Training metadata
โโโ README.md โ Model card
๐ค Contributing
Open to improvements and feedback! Feel free to submit a pull request or open an issue if you find any bugs or want to enhance the model.
Runs of AventIQ-AI Food-Classification-AI-Model on huggingface.co
4
Total runs
0
24-hour runs
0
3-day runs
1
7-day runs
-9
30-day runs
More Information About Food-Classification-AI-Model huggingface.co Model
Food-Classification-AI-Model huggingface.co
Food-Classification-AI-Model huggingface.co is an AI model on huggingface.co that provides Food-Classification-AI-Model's model effect (), which can be used instantly with this AventIQ-AI Food-Classification-AI-Model model. huggingface.co supports a free trial of the Food-Classification-AI-Model model, and also provides paid use of the Food-Classification-AI-Model. Support call Food-Classification-AI-Model model through api, including Node.js, Python, http.
Food-Classification-AI-Model huggingface.co is an online trial and call api platform, which integrates Food-Classification-AI-Model's modeling effects, including api services, and provides a free online trial of Food-Classification-AI-Model, you can try Food-Classification-AI-Model online for free by clicking the link below.
AventIQ-AI Food-Classification-AI-Model online free url in huggingface.co:
Food-Classification-AI-Model is an open source model from GitHub that offers a free installation service, and any user can find Food-Classification-AI-Model on GitHub to install. At the same time, huggingface.co provides the effect of Food-Classification-AI-Model install, users can directly use Food-Classification-AI-Model installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
Food-Classification-AI-Model install url in huggingface.co: