How shreyaschakravarthy19/fooddetectionandcalorieestimation works
Main components
• Frontend:
– Located in the Templates directory (HTML files like dashboard.html, index.html, login.html, etc.)
– Uses Jinja2 templating, CSS, and JavaScript for rendering the user interface.
• Backend:
– The core application is within app.py, which serves as the Flask server handling HTTP requests, routing, and API endpoints.
• Machine Learning (ML) Pipeline:
– High-level steps include image preprocessing, food detection/classification (using models like EfficientNet and potentially MobileNetV2), and calorie estimation.
– Although the ML logic details might reside within the app.py code (or linked modules), note that a Jupyter notebook (efficicientnet_model.ipynb) is provided, likely illustrating the training and evaluation of the deep learning model.
• Database Layer:
– SQLite databases found in the instance folder (food_tracking.db and mini_proj.db) store user meal logs and nutritional data.
• External Services and Data:
– Integration with the USDA Nutritional Database (as indicated in the README), which supplies caloric and nutrient values.
• DevOps / Continuous Integration:
– GitHub workflows in the .github/workflows folder indicate CI/CD pipelines for tasks like building/deploying the site with Jekyll.
Relationships and interactions
• Users interact with the Frontend, uploading images and receiving visual feedback and dashboard insights.
• The Frontend sends requests to the Backend (Flask) which orchestrates the ML pipeline.
• The ML pipeline processes the image: performing food detection, classification, and calorie estimation, and then sends results back to the Flask server.
• The Backend interacts with the SQLite databases to store/retrieve meal logs and nutritional information.
• In cases where nutritional details are required, the system might call the USDA API to verify or enrich data.
• Automated tests (located in the tests folder) ensure integrity and performance, and CI workflows (in the .github folder) manage continuous deployment and testing.
Architectural patterns and design principles
• Model-View-Controller (MVC)-like separation:
– Templates serve as the View, app.py (Flask) as the Controller, and the databases along with ML models serve as the Model.
• Micro-modularity: Even if not explicitly divided into microservices, separating the UI, backend logic, ML inference, and persistence highlights well-defined boundaries.
• Data flow: From image input through ML inference, data storage, and then back as user feedback.