AmanSengar commited on
Commit
97fd5d7
Β·
verified Β·
1 Parent(s): de7b716

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +125 -0
README.md ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🧠 Food-Image-Classification-AI-Model
2
+
3
+ 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.
4
+
5
+
6
+ ---
7
+
8
+
9
+ ## ✨ Model Highlights
10
+
11
+ - πŸ“Œ Base Model: facebook/deit-base-patch16-224
12
+ - πŸ“š Datasets: Food-101 Data
13
+ - 🌿 Classes: 101 food categories (e.g., pizza, ramen, steak, etc.)
14
+ - πŸ”§ Framework: Hugging Face Transformers + PyTorch
15
+
16
+ ---
17
+
18
+ ## 🧠 Intended Uses
19
+
20
+ - βœ… Food image classification in apps/web
21
+ - βœ… Educational visual datasets
22
+ - βœ… Food blog/media categorization
23
+ - βœ… Restaurant ordering support systems
24
+
25
+ ---
26
+
27
+ ## 🚫 Limitations
28
+
29
+ - ❌ May not perform well on poor-quality or mixed-food images
30
+ - ❌ Not optimized for detecting multiple food items per image
31
+
32
+
33
+ ---
34
+
35
+ ## πŸ‹οΈβ€β™‚οΈ Training Details
36
+
37
+ | Attribute | Value |
38
+ |--------------------|----------------------------------|
39
+ | Base Model | facebook/deit-base-patch16-224 |
40
+ | Dataset | Food-101-Dataset |
41
+ | Task Type | Image Classification |
42
+ | Epochs | 3 |
43
+ | Batch Size | 16 |
44
+ | Optimizer | AdamW |
45
+ | Loss Function | CrossEntropyLoss |
46
+ | Framework | PyTorch + Transformers |
47
+ | Hardware | CUDA-enabled GPU |
48
+
49
+ ---
50
+
51
+ ## πŸ“Š Evaluation Metrics
52
+
53
+
54
+ | Metric | Score |
55
+ | ----------------------------------------------- | ----- |
56
+ | Accuracy | 0.97 |
57
+ | F1-Score | 0.98 |
58
+ | Precision | 0.99 |
59
+ | Recall | 0.97 |
60
+
61
+
62
+ ---
63
+
64
+ ---
65
+ πŸš€ Usage
66
+ ```python
67
+ from transformers import AutoImageProcessor, AutoModelForImageClassification
68
+ from PIL import Image
69
+ import torch
70
+ from torchvision.transforms import Compose, Resize, ToTensor, Normalize
71
+
72
+ # Load model and processor
73
+ model_name = "AventIQ-AI/Food-Classification-AI-Model"
74
+
75
+ model = AutoModelForImageClassification.from_pretrained("your-model-path")
76
+ processor = AutoImageProcessor.from_pretrained("your-model-path")
77
+
78
+ def predict(image_path):
79
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
80
+ model.to(device)
81
+
82
+ image = Image.open(image_path).convert("RGB")
83
+ transform = Compose([
84
+ Resize((224, 224)),
85
+ ToTensor(),
86
+ Normalize(mean=processor.image_mean, std=processor.image_std)
87
+ ])
88
+ pixel_values = transform(image).unsqueeze(0).to(device)
89
+
90
+ with torch.no_grad():
91
+ outputs = model(pixel_values=pixel_values)
92
+ logits = outputs.logits
93
+ predicted_idx = logits.argmax(-1).item()
94
+ predicted_label = model.config.id2label[predicted_idx]
95
+
96
+ return predicted_label
97
+
98
+ # Example usage:
99
+ print(predict("Foodexample.jpg"))
100
+
101
+ ```
102
+ ---
103
+
104
+ - 🧩 Quantization
105
+ - Post-training static quantization applied using PyTorch to reduce model size and accelerate inference on edge devices.
106
+
107
+ ----
108
+
109
+ πŸ—‚ Repository Structure
110
+ ```
111
+ .
112
+ beans-vit-finetuned/
113
+ β”œβ”€β”€ config.json βœ… Model architecture & config
114
+ β”œβ”€β”€ pytorch_model.bin βœ… Model weights
115
+ β”œβ”€β”€ preprocessor_config.json βœ… Image processor config
116
+ β”œβ”€β”€ training_args.bin βœ… Training metadata
117
+ β”œβ”€β”€ README.md βœ… Model card
118
+
119
+ ```
120
+ ---
121
+ 🀝 Contributing
122
+
123
+ 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.
124
+
125
+