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.
- 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.
- Python (Pandas, NumPy, scikit-learn)
- PyTorch (for neural network models)
- Joblib (for saving models and scalers)
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.csvbreakfast_data.csvlunch_data.csvdinner_data.csv
- Model and scaler files (e.g.,
calories_model.pth,breakfast_nutrient_model.pth, etc.) are saved after training.
- Prepare Datasets: Place your datasets in the
datasets/folder. - Run Training: Execute
backend.pyto train the calorie prediction and nutrition models. This will output model files and scalers for later inference. - 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.pklfor each meal
To train all models, simply run:
python backend.py- Python 3.6+
- pandas, numpy, scikit-learn
- torch, joblib
Install requirements via:
pip install pandas numpy scikit-learn torch joblibYou can extend the datasets or adjust model architectures in backend.py to fit additional user attributes or meals.
Let me know if you'd like this in markdown file format or need further customization!