This project uses a deep learning model to predict a person's BMI (Body Mass Index) and gender based on two input images: a front-view and a side-view image. The model leverages a pre-trained VGG16 network for feature extraction and has been fine-tuned for this specific task.
This project predicts:
- BMI (Body Mass Index): A numerical value indicating whether a person is underweight, normal, or overweight.
- Gender: Categorized as male or female based on the input images.
The model processes two images: a front view and a side view. Predictions are based on features extracted using a convolutional neural network.
- Two-Image Input: Utilizes front and side view images for accurate prediction.
- BMI Categorization: Categorizes BMI as:
- Underweight
- Normal
- Overweight
- User-Friendly Interface: Supports selecting images using a graphical file dialog.
- Expandable: The model can be further trained or integrated into larger systems.
- Python 3.7 or later
- Required Python libraries:
- TensorFlow
- NumPy
- Pillow
- Tkinter (for GUI)
- Clone this repository:
git clone https://github.com/your-username/BMI-detection-with-facial-features.git cd BMI-detection-with-facial-features
- Install dependencies:
pip install -r requirements.txt
- Download the trained model and save it to the appropriate path:
C:\Users\azadk\OneDrive\Desktop\projects\bmi_detection\log\model_epoch_07_val_loss_29.54.keras
-
Run the script:
python bmi_gender_prediction.py
-
A dialog will prompt you to select two images:
- Front View Image
- Side View Image
-
The script will display:
- Predicted BMI
- BMI Category (Underweight, Normal, Overweight)
- Predicted Gender (Male or Female)
-
Example Output:
Predicted BMI: 23.45 Predicted Gender: Male BMI Category: Over Weight
After running the script, the output is displayed in the terminal. Here’s a breakdown of what each output represents:
-
Predicted BMI:
- A numerical value, such as
23.45
, representing the predicted Body Mass Index.
- A numerical value, such as
-
BMI Category:
- Describes the category based on the BMI:
Underweight
: BMI < 18.5Normal
: 18.5 ≤ BMI < 25Overweight
: BMI ≥ 25
- Describes the category based on the BMI:
- Architecture: Based on VGG16 for feature extraction.
- Input Size: 224x224 pixels for both front and side view images.
- Outputs:
- BMI (continuous value)
- Gender (binary classification: Male/Female)
- Image Quality: Low-resolution or poorly-lit images may affect predictions.
- Bias: The model's accuracy may vary based on the dataset it was trained on.
- Generalization: Predictions may not generalize well to certain populations or body types not represented in the training data.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature-branch
- Commit your changes:
git commit -m "Description of changes"
- Push to your branch and create a pull request.