Skip to content

klnlokeshkumar/Smart-diet-planner

Repository files navigation

Smart Diet Planner

Smart Diet Planner is a machine learning-based application that predicts daily calorie needs and provides personalized nutrition recommendations for breakfast, lunch, and dinner. It leverages PyTorch for model training and prediction, and uses datasets to tailor diet plans to individual profiles.

Features

  • Calories Prediction: Predicts the daily calories required to maintain weight based on personal attributes (age, weight, height, gender, BMI, BMR, activity level).
  • Meal-wise Nutrition Prediction: Provides nutritional breakdowns (macronutrients, micronutrients, etc.) for each meal, customized to caloric goals.
  • End-to-End Pipeline: Includes data preprocessing, model training, evaluation, and saving of model artifacts for production use.

Technology Stack

  • Python (Pandas, NumPy, scikit-learn)
  • PyTorch (for neural network models)
  • Joblib (for saving models and scalers)

Project Structure

  • backend.py — Main script for data processing, model training, and serialization.
  • datasets/ — Directory containing the input CSV datasets used for model training.
    • human_input_to_calories_dataset.csv
    • breakfast_data.csv
    • lunch_data.csv
    • dinner_data.csv
  • Model and scaler files (e.g., calories_model.pth, breakfast_nutrient_model.pth, etc.) are saved after training.

Usage

  1. Prepare Datasets: Place your datasets in the datasets/ folder.
  2. Run Training: Execute backend.py to train the calorie prediction and nutrition models. This will output model files and scalers for later inference.
  3. Model Outputs: After training, you will find files such as:
    • calories_model.pth, calories_scaler_X.pkl, gender_label_encoder.pkl
    • {meal}_nutrient_model.pth, {meal}_scaler_X.pkl, {meal}_scaler_y.pkl, {meal}_targets.pkl, {meal}_data.pkl for each meal

Example

To train all models, simply run:

python backend.py

Requirements

  • Python 3.6+
  • pandas, numpy, scikit-learn
  • torch, joblib

Install requirements via:

pip install pandas numpy scikit-learn torch joblib

Customization

You can extend the datasets or adjust model architectures in backend.py to fit additional user attributes or meals.

License

MIT


Let me know if you'd like this in markdown file format or need further customization!

About

Smart Diet Planner uses PyTorch and scikit-learn to predict daily calorie needs and generate personalized meal plans with detailed nutrition insights for each meal.

Topics

Resources

Stars

Watchers

Forks

Contributors