NutriInsightX is an AI-powered food label analysis platform that combines Optical Character Recognition (OCR), Machine Learning, and nutritional risk assessment to help users understand packaged food products.
The system extracts ingredient information from food labels, detects allergens and additives, evaluates health risks, and predicts Nutri-Score grades using a Random Forest classifier trained on the OpenFoodFacts Kaggle dataset.
|
Training Samples |
Model Accuracy |
Nutritional Features |
Nutri-Score Classes |
flowchart TD
A["π¦ OpenFoodFacts Dataset
190,969 Records"]
--> B["π§Ή Data Cleaning"]
--> C["βοΈ Feature Selection"]
--> D["π Nutritional Features
Energy
Fat
Saturated Fat
Sugar
Protein
Fiber
Salt"]
--> E["βοΈ Train-Test Split
80% / 20%"]
--> F["π² Random Forest Training"]
--> G["π Hyperparameter Tuning"]
--> H["π Model Evaluation"]
--> I["π― Accuracy
94.54%"]
--> J["π Nutri-Score Prediction
A β’ B β’ C β’ D β’ E"]
OpenFoodFacts (Kaggle)
190,969 Food Products
nutrition_grade_fr
energy_100g
fat_100g
saturated-fat_100g
sugars_100g
proteins_100g
fiber_100g
salt_100g
| Metric | Value |
|---|---|
| Dataset | OpenFoodFacts |
| Records | 190,969 |
| Algorithm | Random Forest |
| Accuracy | 94.54% |
| Target | nutrition_grade_fr |
| Classes | A, B, C, D, E |
| Grade | Precision | Recall | F1-Score |
|---|---|---|---|
| A | 0.97 | 0.95 | 0.96 |
| B | 0.90 | 0.91 | 0.91 |
| C | 0.93 | 0.94 | 0.94 |
| D | 0.96 | 0.96 | 0.96 |
| E | 0.97 | 0.94 | 0.96 |
|
|
|
|
|
|
Food Package Image
β
βΌ
EasyOCR
β
βΌ
Ingredient Extraction
β
ββββββββΌβββββββββ
βΌ βΌ βΌ
Language Allergens Additives
Detect Detect Detect
β
βΌ
Health Risk Engine
β
βΌ
Random Forest Model
β
βΌ
Nutri-Score Prediction
β
βΌ
Recommendations
| Layer | Technologies |
|---|---|
| User Interface | Streamlit |
| Computer Vision | EasyOCR, OpenCV, Pillow |
| Machine Learning | Scikit-Learn, Random Forest |
| Data Processing | Pandas, NumPy |
| Language Detection | LangDetect |
| Visualization | Streamlit Charts, Matplotlib |
| Dataset | OpenFoodFacts (Kaggle) |
| Programming Language | Python 3.11 |
NutriInsightX
β
βββ app.py
βββ preprocess.py
βββ train_model.py
β
βββ src
β βββ ocr_engine.py
β βββ allergen_detector.py
β βββ additive_detector.py
β βββ health_risk.py
β βββ language_detector.py
β βββ recommender.py
β βββ nutriscore_predictor.py
β
βββ knowledge_base
β βββ allergens.json
β βββ food_additives.json
β
βββ screenshots
β
βββ dataset
β
βββ models
git clone https://github.com/LovelySharma-dev/NutriInsightX.git
cd NutriInsightX
pip install -r requirements.txt
streamlit run app.py- SHAP Explainability Integration
- Barcode Scanner Support
- Real-Time Camera OCR
- Automated Nutrition Extraction
- Product Comparison Engine
- Mobile Application
This project is licensed under the MIT License.
See the LICENSE file for details.
AI-Powered Food Label Analysis Using OCR and Machine Learning




