## **swim-net**

**Get Code [Link](https://github.com/Scornz/swim-net)**

## Inspiration

Recruiting is *hard*. Like really difficult. Sifting through endless piles of times, meets, and races can be exhausting, and can often lead to a lot of missed potential. The three of us are on the Princeton swim team and have gone through this (stressful) college athletic recruiting process. Coaches scour the web for these raw times, attempting to gauge which athletes would fit best for their team. It's unfortunately not as simple as sorting by the fastest swimmer, as many are simply gearing up to become much faster in college. However, coaches have limited time, and often missing these "hidden gems" of athletes who haven't quite hit the peak of their career.

Our goal was to be able to *automate* this process for coaches, and be able to detect these abstract correlations that come together to form these "hidden gem" recruits.

## What it does

Takes an athlete's best high school times for each age (so 50 Freestyle would have four entries, one for age 15, 16, 17, and 18), and outputs a metric on how their expected performance would be in college. This could be expected percentage improved or perhaps their projected amount of power points in their top events (power points are a standardized metric of speed throughout swimming).

## How we built it

There are quite a few layers to this project. We'll label it in three, (somewhat) succinct steps:

1. We first used web scraping to attain a large list of swimmers (roughly 1,500), that had graduated college (and thus would offer a good metric of improvement from high school to college). This data was mainly taken from a platform known as [Swimcloud](swimcloud.com).
2. We then used said list of swimmers to scrape another site (<usaswimming.org>), for their best times at each age, and their power index (a numerical value given to the performance of a swim). Through some magic, we grab Excel spreadsheets and reorganize them into CSV input for the DNN (deep neural network) in the next step.
3. We used a DNN model for this regression problem (continuous input mapped to continuous output). Without getting too in-depth on what is going on under the hood, this model is essentially a beefed-up multilayer-perceptron (a feed-forward only series of neurons) that takes in an input size of 56 (14 events times 4 age categories) and will output the desired metric.

## Challenges we ran into

* Getting data for this was *difficult*, to say the least. The only publicly available database was a rather poorly organized web client on [USA Swimming](usaswimming.org). In order to even access most of the data, a name needed to be entered, an Excel spreadsheet downloaded, wait for that to complete, and then move on to the next swimmer (all of which took around 6-7 seconds, but doing this 1,260 times took a little over 3 hours). In order to get data from a swimmer, we needed to know their *name*. We improvised by web scraping these names from a different website called [Swimcloud](swimcloud.com).
* The deep neural network was having some significant trouble with overfitting at first (that is, the training data was showing significantly greater accuracy than the testing data). After a few hours of experimentation, this was mostly mitigated by adding dropout layers and conducting f-score feature selection on the events.
* Getting our video to be under 2 minutes in length (we just had so much to share!)

## Accomplishments that we're proud of

It actually works! We believe that is something to be proud of after all of this hard work. We'll go into some specific details about *how* well it did here.

Let's look at the progression of the loss functions over the epochs for the output metric of power points.
![Top 3 Power Points Graph](https://github.com/Scornz/swim-net/blob/main/figures/top3_power_points.png?raw=true)

In the end, based *solely* on times from high school, our DNN was able to successfully predict the average power points of a swimmer's events *after* completing college with plus or minus 75 points. Keep in mind that power points begin at 0 and can go up and above 1200! This is rather astounding! On no other data other than the best times of a swimmer throughout high school, our DNN was able to draw significant correlations to their performance in college.

There are a few other graphs located in the github repo [here](https://github.com/Scornz/swim-net) if you would like to explore a few other output metrics that we measured (such as predicting the amount improved within 2%).

## What we learned

In order to even approach this, a significant amount of data needed to be collected. Overall, over 1,260 graduated, collegiate swimmers were analyzed, saved, and then used to train the neural network. There were some very interesting correlations between data, confirming a lot of trends swimmers see in the pool every day. Below is an interesting example of this:
![50 Fly, 100 Breast, 200 IM Diag Chart](https://github.com/Scornz/swim-net/blob/main/figures/100BR_100FL_200IM.png?raw=true)

The graph represents the correlation between three different events (100 Fly, 100 Breast, and 200 IM), while along the diagonal is a kernel density estimation plot (displaying the rough distribution of times in each event). There is an amazingly clear correlation between the speed in the 200 IM and 100 Breaststroke (seen in the top left and bottom right corners). As one gets faster in IM, they generally become a significantly better breaststroker (and vice versa). Being able to see this correlation confirmed through a scatter plot such as this was *truly amazing*. There were many more correlations like the one above, but we won't cloud this description area with **every** cool thing we uncovered.

## What's next for swim-net?

Is there potential for swim-net outside of this hackathon? **Absolutely**, no question about it. Even given the short time span, and the extremely limited access to a good database, we were still able to uncover rather impressive correlations. Some simple ways to improve in the future include changing the output metric (in the graphs above, the power points and ratio improved from the top three events were used). We could also investigate a swimmers' overall performance in all events, points scored at college competitions or other (possibly endless) output metrics.

Not to mention, despite the rather specific name, swim-net can also be expanded into similar sports. This includes track and field, where athletes are measured on an individual, timed basis in a racing environment.
## Inspiration

Hiring an athletic trainer is expensive and logistically troublesome. But for our beloved friends who're insanely into playing sports, and our family who're aspiring to improve their performance, perhaps playing as a starter in a varsity team or simply challenging themselves, there is simply no other way than hiring an hourly-rating athletic trainer. We want to say goodbye to the hassle and expense and provide you with a more personalized, professional, and wholistic fitness journey.

## What it does

With Put Me In – the world's first personal coach on your arm, adaptable to multiple sports – you have professional guidance at your fingertips. Our smart sleeve, driven by cutting-edge machine learning, assesses your movements across sports like basketball and weightlifting, offering personalized insights for improvement. But it doesn't stop there – it also tracks your progress, ensuring safer and more effective workouts.

## Market sizing & demand

Every year, there are approximately $5 billion (TAM) spent on hiring an athletic trainer from amateur and other levels of non-professional athletes, and their average expense hourly is about $50-150. We've connected with 30 athletes on different levels, ranging from college varsity team members playing below NCAA D2 to amateur fitness athletes, and researched that their willingness to pay for training purposes is about maxi 200 USD per month. Taking into other necessary data accounts, we have a Serviceable Available Market (SAM) of about 1 billion per year.

## How we built it

We stitched together a sleeve that places 3 IMU sensors on the bicep, forearm, and hand. One of the greatest challenges in tracking sports performance with sensors is that labelled data can be costly to acquire, and so it is vital to find efficient algorithms to classify or analyze these types of movements and sensor data. We developed a dynamic time warping-based time series classification algorithm that is label-efficient, highly generalizable across sport modalities and different individuals, and lightweight enough to run on a Raspberry Pi that we have detachable from our wearable sleeve.

To get all these relevant data and insights to our users, we built a web app in Reflex. When you put on a sleeve and begin shooting, the data from the sensor gets transferred to our web app. There, we display a visualization of your practice movement (shot or weightlift). This visualization is rendered via a custom kinematics-based positional updating that we do to track relative positioning of the sensors based on accelerometer and gyro axes. Simultaneously, based on our machine learning motion analysis and DTW-based classification of your athletic form, we will display feedback on how your form could be improved. The web app also allows users to log into their accounts for an existing wearable such as a Garmin watch, and include that supplementary data. Finally, the web app also includes a viewer for video tutorials from Youtube trainers (which we envision could one day be a suite of “Put Me In” personal trainers and their video lessons.)

## What's next for Put Me In, Coach

Our vision for what's coming next? To democratize elite fitness technology for everyone. We want to use our model and expand it to a much greater variety of sports from arm-involved sports to lower-limbed focused programs such as football, etc. Through an affordable monthly subscription, equivalent to just a few hours with a traditional trainer, Put Me In brings professional coaching within reach. And with Put Me In, training becomes not only professional but enjoyable too. Don't wait – elevate your game with Put Me In today.
## Members

Keith Khadar, Alexander Salinas, Eli Campos, Gabriella Conde

## Inspiration

Last year, Keith had a freshman roommate named Cayson who had played high school football until a knee injury sidelined him. While his condition improved in college—allowing him to walk, he couldn’t run. Keith remembered how he often had to make a 30-minute walk to his physical therapist. It was through witnessing his struggle and through Keiths experience working on medical devices in Dream Team Engineering, a Club at the University of Florida dedicated to improving patient care, and our curiosity to work on real world problems with AI, that we began to think about this issue.

## What it does

Our device tracks an injured athlete's movements and provides personalized advice, comparable to that of a world-class physical therapist, ensuring the patient recovers effectively and safely. Our device helps users perform physical therapy exercises at home safely while AI analyzes their movements to ensure they operate within their expected range of motion and effort values.

## How we built it

Using web technologies (Angular, Python, Tune) and microcontrollers (Flex-sensor + ESP32) to track, give insights, and show improvement over time.

## Challenges we ran into

Bluetooth Implementation: Establishing a reliable and efficient Bluetooth connection between the microcontroller and our web application proved more complex than anticipated.
Sleeve Assembly: Designing and constructing a comfortable, functional sleeve that accurately houses our sensors while maintaining flexibility was a delicate balance.
Data Interpretation: Translating raw sensor data into meaningful, actionable insights for users required extensive algorithm development and testing.
Cross-platform Compatibility: Ensuring our web application functioned seamlessly across various devices and browsers presented unexpected complications. Specifically browser as well as

## Accomplishments that we're proud of

Seamless Bluetooth Integration: We successfully implemented robust Bluetooth communication between our hardware and software components, enabling real-time data transfer.
Real Time Digital Signal Processing: Our team developed sophisticated algorithms to analyze data from our sensors, providing a comprehensive view of the user's movements and progress.
Intuitive User Interface: We created a user-friendly interface that clearly presents complex data and personalized recommendations in an easily digestible format.
Rapid Prototyping: Despite time constraints, we produced a fully functional prototype that demonstrates the core capabilities of our concept.
Tune AI Integration: We are proud of our connection to tune ai and using their llama ai model to provide insights into the patients movements.

## What we learned

Full-Stack Development: We gained valuable experience in integrating frontend and backend technologies, particularly in using Python for backend operations and Angular for the frontend.
Interdisciplinary Collaboration: We learned the importance of effective communication and teamwork when combining expertise from various fields (e.g., software development, hardware engineering, and physical therapy).
Real-world Problem Solving: This experience reinforced the value of addressing genuine societal needs through innovative technological solutions.

## What's next for Glucose

Enhanced Sensor Array: Integrate additional sensors (e.g., accelerometers, gyroscopes) for more comprehensive movement tracking and analysis.
Machine Learning Integration: Implement more advanced ML algorithms to improve personalization and predictive capabilities of our advice engine.
Clinical Trials: Conduct rigorous testing with physical therapists and patients to validate and refine our system's effectiveness.
Mobile App Development: Create dedicated iOS and Android apps to increase accessibility and user engagement.
Expanding Use Cases: Explore applications beyond athletic injuries, such as rehabilitation for stroke patients or elderly care. Another use case is to help correct diagnostic error. We will have a lot of data on how the patient moves and we can train machine learning models to then analyze that data and affirm the diagnostic that the doctor gave.