Skip to content

Commit

Permalink
Merge branch 'NiharGharat:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
NDK22 authored May 11, 2023
2 parents 81cb3a9 + a157e6b commit dbbbd47
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 17 deletions.
55 changes: 44 additions & 11 deletions notes/ReadingMaterial.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,51 @@


## Datasets
1. [Gym Exercise Dataset](https://www.kaggle.com/datasets/niharika41298/gym-exercise-data/code)
1. [Gym Exercise Dataset](https://www.kaggle.com/datasets/niharika41298/gym-exercise-data/code)
- Different Exercises title and their description in different columns. It also has what type of exercise it is and what body part it has most impact.
2. [Human Activity Recognition Using Smartphones Data Set](https://archive.ics.uci.edu/ml/datasets/human+activity+recognition+using+smartphones)
- Exercise performed by people that includes six activities (WALKING, WALKING_UPSTAIRS, WALKING_DOWNSTAIRS, SITTING, STANDING, LAYING)
3. [FitBit Fitness Tracker Data](https://www.kaggle.com/datasets/arashnic/fitbit/code)
- Data showing daily calories burned by people through different exercises. (18 csv files only some are useful)
4. [Workout Exercises Video](https://www.kaggle.com/datasets/hasyimabdillah/workoutfitness-video)
- Video data of people doing all types of exercises with each exercise videos in their name folder. Will be useful in future when we are developing app.
5. [2018 calorie, exercise and weight changes](https://www.kaggle.com/datasets/chrisbow/2018-calorie-exercise-and-weight-changes)
- Data showing the food intake weight, ounces and calories intake.
6. [Fitness Trackers Products Ecommerce](https://www.kaggle.com/datasets/devsubhash/fitness-trackers-products-ecommerce)
- Fitness products and their brands, materials etc.
7. [Lifesnaps Fitbit dataset](https://www.kaggle.com/datasets/skywescar/lifesnaps-fitbit-dataset)
- Hourly bpm, temperature, activity etc not aligned with our data requirements.
8. [Yoga Pose Image classification dataset](https://www.kaggle.com/datasets/shrutisaxena/yoga-pose-image-classification-dataset)
- Different yoga pose images in their respective folders.
9. [Food and their calories](https://www.kaggle.com/datasets/vaishnavivenkatesan/food-and-their-calories)
- Different types of food and their respective calories. Will be useful in future if we are adding a dietery meal information.
10. [Fitness Trends Dataset](https://www.kaggle.com/datasets/aroojanwarkhan/fitness-data-trends)
- Step count, calories, sleep hours, blood pressure and weights
- parameters can be used for profile building.
11. [Yoga Posture Dataset](https://www.kaggle.com/datasets/tr1gg3rtrash/yoga-posture-dataset)
- Yoga images postures not useful for our data requirements.
12. [Apple Watch and Fitbit data](https://www.kaggle.com/datasets/aleespinosa/apple-watch-and-fitbit-data)
- Age, height, weight, heart_rate and calories.
13. [Workout/Exercise Images](https://www.kaggle.com/datasets/hasyimabdillah/workoutexercises-images)
- Workout images can be used for app in future.
14. [🏋️‍♀️🏋️‍♂️Fitness Exercises🏋️‍♀️🏋️‍♂️](https://www.kaggle.com/datasets/edoardoba/fitness-exercises-with-animations)
- Exercise Names and what body part the exerciese is useful for.
15. [Fitness Analysis](https://www.kaggle.com/datasets/nithilaa/fitness-analysis)
- Fitness analysis of different people exercises and there outcomes.
16. [Calories Burned During Exercise and Activities](https://www.kaggle.com/datasets/aadhavvignesh/calories-burned-during-exercise-and-activities)
- Calories burned in different exercises.
17. [Fitness Consumer Survey Data](https://www.kaggle.com/datasets/harshitaaswani/fitness-consumer-survey-data)
- Exercise survey data of different people how often they do exercises.
18. [powerlifting-database](https://www.kaggle.com/datasets/dansbecker/powerlifting-database)
- Power lifting data information not really useful over here.
19. [Crossfit Athletes](https://www.kaggle.com/datasets/ulrikthygepedersen/crossfit-athletes)
- Data related to team competitions not userful over here.
20. [Yoga Vid Collected](https://www.kaggle.com/datasets/pulaksarmah/yoga-videos)
- Yoga pose recognition video data.
21. [Powerlifting Database](https://www.kaggle.com/datasets/open-powerlifting/powerlifting-database)










- Powerlifting data of different people depending on their weight and no of squats.
22. [CardioGoodFitness](https://www.kaggle.com/datasets/saurav9786/cardiogoodfitness)
- FItness vs education, income, miles etc.


# To watch
Expand Down
69 changes: 63 additions & 6 deletions src/RecommenderEngine.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,81 @@
import numpy as np
import tensorflow as tf
from keras import models, layers, losses, regularizers
import pandas as pd

# loading the exercise reference data.
data_reference = pd.read_csv("src/resources/data/exercise_raw.csv", index_col=False)
# To keep a reference of the exercise names.
exercise_data = data_reference.iloc[:, 1].values

class RecommenderEngine:

def __init__(self) -> None:
self.model = None
pass

def handle_model_creation(self):
def handle_model_creation(self, train):
'''
Do model creation part
Create the model, or load from the file
'''
pass
model = models.Sequential()
# Adding the Conv2D layer to the model with fileters = 8, kernel size = (3, 3), strides = (1,1), padding='same', activation='relu' and a L2 Regularization of 0.0001.
model.add(layers.Conv2D(filters = 8, kernel_size = (3,3), strides = (1,1), padding='same', activation='relu', input_shape = train.shape[1:], kernel_regularizer = regularizers.l2(0.0001)))
# Adding the Conv2D layer to the model with filters = 16, kernel_size = (3,3), strides = (1,1), padding='same', activation='relu' and a L2 Regularization of 0.0001.
model.add(layers.Conv2D(filters = 16, kernel_size = (3,3), strides = (1,1), padding='same', activation='relu', kernel_regularizer = regularizers.l2(0.0001)))
# Adding the Max Pooling layer with a pool size of (2,2), strides = (2,2).
model.add(layers.MaxPooling2D(pool_size = (2,2), strides = (2,2)))
# Adding the Conv2D layer to the model with filters = 32, kernel_size = (3,3), strides = (1,1), padding='same', activation='relu' and a L2 Regularization of 0.0001.
model.add(layers.Conv2D(filters = 32, kernel_size = (3,3), strides = (1,1), padding='same', activation='relu', kernel_regularizer = regularizers.l2(0.0001)))
# Adding the Conv2D layer to the model with filters = 64, kernel_size = (3,3), strides = (1,1), padding='same', activation='relu' and a L2 Regularization of 0.0001.
model.add(layers.Conv2D(filters = 64, kernel_size = (3,3), strides = (1,1), padding='same', activation='relu', kernel_regularizer = regularizers.l2(0.0001)))
# Adding the Max Pooling layer with a pool size of (2,2), strides = (2,2).
model.add(layers.MaxPooling2D(pool_size = (2,2), strides = (2,2)))
# Adding a flatten layer to the model.
model.add(layers.Flatten())
# Adding a dense layer to the model with units = 512, activation='relu' and L2 Regularization of 0.0001.
model.add(layers.Dense(units = 512, activation='relu', kernel_regularizer = regularizers.l2(0.0001)))
# Adding a dense layer to the model with units = 10, activation='linear' and L2 Regularization of 0.0001.
model.add(layers.Dense(units = 50, activation='linear', kernel_regularizer = regularizers.l2(0.0001)))
# Adding a softmax layer to the output layer.
model.add(layers.Activation('softmax'))
# Compiling the Neural Network model with adam optimizer, loss = losses.categorical_crossentropy and metrics as 'accuracy'.
model.compile(optimizer = 'adam', loss = losses.categorical_crossentropy, metrics = ['accuracy'])

return model

def train(self):
def train(self, train, test):
'''
A wrapper for training if needed
'''
pass
predicted_labels = None
if train.shape[0] % 21 == 0:
model = self.handle_model_creation(train)

history = model.fit(x = train, y = train, epochs = 10, batch_size = 1, validation_split = 0.2)
# Predict the probabilities for each class in the output layer
predictions = model.predict(test)
predicted_labels = np.argmax(predictions, axis=1)
else:
# No training happening if the data count is not above 21 rows.
pass

return predicted_labels

def predict(self) -> str:
def predict(self, exercise_data, train, test) -> str:
'''
A wrapper for predicting if needed
'''
pass
probabilities = self.train(train, test)

# Combine the two lists using zip()
combined = list(zip(exercise_data, probabilities))

# Sort the combined list based on the exersise probabilites (in descending order)
sorted_combined = sorted(combined, key=lambda x: x[1], reverse=True)

# Get the top 5 exercise recommendataions
top_5 = sorted_combined[:5]

return top_5

0 comments on commit dbbbd47

Please sign in to comment.