BinhQuocNguyen commited on
Commit
b8fc535
·
verified ·
1 Parent(s): 2171936

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +119 -0
README.md ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - food-recognition
5
+ - computer-vision
6
+ - calorie-estimation
7
+ - efficientnet
8
+ - nutrition
9
+ - health
10
+ pipeline_tag: image-classification
11
+ ---
12
+
13
+ # Food Recognition and Calorie Estimation Model
14
+
15
+ A comprehensive deep learning system for food recognition, object detection, and calorie estimation using TensorFlow, YOLO, and EfficientNet.
16
+
17
+ ## Model Description
18
+
19
+ This model combines multiple deep learning approaches to provide accurate food recognition and calorie estimation:
20
+
21
+ - **Food Classification**: EfficientNet-B0 based multi-label classifier for 101 food categories
22
+ - **Object Detection**: YOLO v8 for detecting multiple food items in images
23
+ - **Portion Size Estimation**: Computer vision techniques for size estimation
24
+ - **Calorie Calculation**: Integration with USDA nutritional database
25
+
26
+ ## Model Performance
27
+
28
+ | Metric | Value |
29
+ |--------|-------|
30
+ | Classification Accuracy | >85% |
31
+ | Object Detection mAP | >0.75 |
32
+ | Calorie Estimation Accuracy | ±20% |
33
+ | Inference Speed | <2 seconds/image |
34
+
35
+ ## Usage
36
+
37
+ ### Basic Usage
38
+
39
+ ```python
40
+ from transformers import pipeline
41
+
42
+ # Load the model
43
+ classifier = pipeline("image-classification", model="BinhQuocNguyen/food-recognition-model")
44
+
45
+ # Analyze a food image
46
+ result = classifier("path/to/food_image.jpg")
47
+ print(f"Detected foods: {result}")
48
+ ```
49
+
50
+ ### Advanced Usage
51
+
52
+ ```python
53
+ import torch
54
+ from transformers import AutoModel, AutoImageProcessor
55
+ from PIL import Image
56
+
57
+ # Load model and processor
58
+ model = AutoModel.from_pretrained("BinhQuocNguyen/food-recognition-model")
59
+ processor = AutoImageProcessor.from_pretrained("BinhQuocNguyen/food-recognition-model")
60
+
61
+ # Process image
62
+ image = Image.open("food_image.jpg")
63
+ inputs = processor(images=image, return_tensors="pt")
64
+
65
+ # Get predictions
66
+ with torch.no_grad():
67
+ outputs = model(**inputs)
68
+ predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
69
+ ```
70
+
71
+ ## Training Data
72
+
73
+ The model was trained on:
74
+ - **Food-101 Dataset**: 101,000 images across 101 food categories
75
+ - **Additional Datasets**: Food-11, Recipe1M+ (where available)
76
+ - **Data Augmentation**: Rotation, flip, brightness, contrast adjustments
77
+
78
+ ## Nutritional Database
79
+
80
+ The model includes nutritional information for 101 food categories with:
81
+ - Calories per 100g
82
+ - Protein, carbohydrate, and fat content
83
+ - Portion size estimation capabilities
84
+
85
+ ## Limitations
86
+
87
+ - Accuracy may vary with image quality and lighting conditions
88
+ - Calorie estimates are approximate and should not replace professional dietary advice
89
+ - Model performance depends on food items being within the trained categories
90
+ - Portion size estimation is based on visual cues and may not be accurate for all cases
91
+
92
+ ## Citation
93
+
94
+ ```bibtex
95
+ @misc{food-recognition-model,
96
+ title={Food Recognition and Calorie Estimation Model},
97
+ author={BinhQuocNguyen},
98
+ year={2024},
99
+ publisher={Hugging Face},
100
+ howpublished={\url{https://huggingface.co/BinhQuocNguyen/food-recognition-model}}
101
+ }
102
+ ```
103
+
104
+ ## License
105
+
106
+ This model is licensed under the MIT License.
107
+
108
+ ## Contact
109
+
110
+ For questions or issues, please contact:
111
+ - GitHub: [Food Recognition Repository](https://github.com/BinhQuocNguyen/food-recognition-model)
112
+
113
+ ## Acknowledgments
114
+
115
+ - Food-101 dataset creators
116
+ - TensorFlow team
117
+ - Hugging Face team
118
+ - USDA Food Database
119
+ - OpenCV community