Neural Bite - AI-Powered Nutrition & Food Quality Inspection Mobile App
An Android app combining RAG-based and computer vision with explainable AI.

Project Overview
Neural Bite is a cutting-edge Android application that leverages AI to help users make informed dietary choices and assess food quality.
The app features a Personal AI Nutritionist powered by Retrieval-Augmented Generation (RAG), which provides context-aware, evidence-based nutritional guidance tailored to the user's health profile and scan history.
The AI Freshness Scanner uses a multi-stage computer vision pipeline (YOLO detection + MobileNetV2 classification + OOD detection) to identify fruit type and condition with high accuracy, and visualizes decision areas via attention heatmaps.
Built with modern Android technologies (Jetpack Compose, Material 3, MVVM, Room, Retrofit), the app ensures a smooth, responsive user experience with light/dark mode support.
The complete ML pipeline includes data preparation, YOLO training for fruit detection, MobileNetV2 training for fruit/condition classification, and Mahalanobis distance-based out-of-distribution detection for rejecting non-target objects.
All models are quantized to TFLite format for on-device inference, ensuring privacy and low latency (under 600ms for multi-fruit scenes).
Key Features
- Personal AI Nutritionist (RAG) — Context-aware chat assistant using Retrieval-Augmented Generation with Hugging Face LLM and embeddings. It remembers user age, gender, health conditions, and previous scan results to provide tailored, verified nutritional advice grounded in a local knowledge base.
- AI Freshness Scanner — Real-time fruit quality analysis for 5 fruit types (Apple, Banana, Grape, Mango, Orange). Detects condition: Fresh, Rotten, or Formalin-mixed using a YOLO + MobileNetV2 multi-head architecture.
- Attention Heatmaps (Explainable AI) — Visualizes the AI's focus areas via an integrated attention head that produces 14×14 heatmaps, showing exactly where the model detected quality issues or identifying features.
- Out-of-Distribution (OOD) Detection — Rejects non-target objects (e.g., non-fruit items) using Mahalanobis distance on 1280-dimensional feature vectors, preventing false positives and ensuring reliability.
- Image Quality Assessment — Pre-flight checks for blur, brightness, and resolution to guide users for optimal scanning conditions, improving overall accuracy.
- Personalized Health Profile — Stores user health data (age, gender, conditions) locally via Room database, enabling personalized dietary recommendations from the AI nutritionist.
- Multi-Fruit Support — Detects and classifies multiple fruits in a single image simultaneously, with individual results for each fruit crop.
- Modern UI/UX — Built with Jetpack Compose and Material 3, featuring fluid animations, light/dark themes, and a fresh green aesthetic for an engaging user experience.
Technical Highlights
- Retrieval-Augmented Generation (RAG) — Integrates Hugging Face inference API for LLM and embeddings, enabling contextual, evidence-based nutritional chat that references a local knowledge base and user context.
- Multi-Stage Computer Vision Pipeline — Combines YOLOv8-nano for fruit detection (trained on 10,154 images) and a custom multi-head MobileNetV2 for fruit/condition classification + attention output. Quantized to INT8 TFLite for mobile efficiency.
- Explainable AI with Attention Maps — An additional head in the classifier learns a 14×14 spatial attention map, approximating Grad-CAM without backprop, providing visual interpretability of model decisions.
- Out-of-Distribution Detection — Uses Mahalanobis distance with per-class centroids and precision matrices computed from training features, calibrated with a threshold to reject non-fruit inputs.
- On-Device Inference — All models are compressed to 3 MB each (quantized), with inference time ~300-500ms for YOLO and ~50-100ms per crop for classifier, total <600ms for 3 fruits on Snapdragon 765G.
- MVVM Architecture with DI — Clean separation of concerns with ViewModels, Repositories, and manual dependency injection, making the code testable and maintainable.
- Jetpack Compose & Material 3 — Modern declarative UI toolkit for building responsive, adaptive interfaces with built-in theming and dynamic color support.
Challenges & Solutions
Tech Stack Breakdown
frontend
Android (Kotlin), Jetpack Compose, Material 3, ViewModel, LiveData/Flow
backend
Hugging Face Inference API (LLM + embeddings), Retrofit, OkHttp
local_storage
Room Database (SQLite) for user profiles and chat history
ml_models
TensorFlow Lite (YOLOv8-nano for detection, custom MobileNetV2 multi-head for classification+attention+OOD features)
ml_development
PyTorch, ultralytics (YOLO), OpenCV, scikit-learn, NumPy
tools
Android Studio, Git, Gradle, Kaggle (model training), ONNX, TensorFlow Converter
deployment
Signed APK, Google Play Store (planned)