You are browsing as a guest. Sign up (or log in) to start making projects!

SPARC

  • 3 Devlogs
  • 11 Total hours

AI-powered Spinal Posture Assessment and Risk Classifier

Ship #1 Pending review

Hey! My name is Sophia, and I made SPARC (Spinal Posture Assessment and Risk Classifier), a web app that harnesses the power of AI by using the object detection framework YOLO to analyze the severity of a person’s scoliosis with an image of their back.

Scoliosis is a medical condition where a person has an abnormal curvature of the spine. Through SPARC, everyone can track and detect scoliosis to reduce the risk of requiring surgery!

Please read the following information before you try this project:

  • Access SPARC at this link: https://spu314.hackclub.app/index.html, or run it locally. BUT due to nest’s limitations, it is SUPER slow when you are not running it locally. If you want proof, just check out the demo video I have in my readme (at this drive link: https://drive.google.com/drive/folders/1eXi6Yc8do5UbdwkRtm8zSdeHkoL0qRMu?usp=sharing ) Clearly, the model takes <2 seconds to analyze the images when locally run, but can take UP TO A MINUTE at that website. If you are not using SPARC frequently, I recommend just using https://spu314.hackclub.app/index.html, but keep in mind the speed limitations!
  • I highly recommend reading the Guide, FAQ, Info, and About pages before you visit the Dashboard. One important fact from my Guide page that I really want to stress is, “Keep in mind that the model performs best on clear, high-resolution images where the entire back is visible. Therefore, performance may decrease on low-resolution or blurry images, under poor lighting, or when there is little contrast between the person’s back and the background.” So to try out the model, I wouldn’t recommend using online images from searching “scoliosis images of a person’s back” (yes I searched this up too when finding sample images and eventually had to use images from other people’s datasets) as some of those images have poor lighting and bad quality.

My motivation:

  • My family and I recently discovered that my twin sister had severe scoliosis and required surgery after examining the imbalance in her shoulder blades. I remember researching the necessary treatments and reading the stories of other scoliosis patients, only to discover that the best solution for severe scoliosis was to prevent it in the first place. As a result, I decided to help other scoliosis patients by creating SPARC, Spinal Posture Assessment and Risk Classifier.

SPARC’s features:

  • Dashboard: Literally the MOST IMPORTANT part of this project! This is where you will create sessions and view previous sessions. In each session, you can upload images of your back or use the sample images. Then you will see the model’s output (a downloadable image of the spine points on the uploaded image) and conclusions (spine deviation %, hip tilt°, shoulder tilt°, confidence level %, and the data coordinates of the spine points shown in the results image)
  • Home: landing page
  • About: a little about me and why I created this project
  • Info: about scoliosis types and treatments
  • FAQ: in case you have any questions!

Challenges:

  • Overall, one of the most challenging parts was beginning this project as I had so many ideas for the final result but no experience in training models. However, I overcame this barrier by checking out other people’s projects and databases on Roboflow, and reading articles about YOLO on Medium!

  • Another challenge I encountered occurred during deployment as I looked online for free options like PythonAnywhere but encountered tons of disk limit exceeded errors before I used nest.

Finally, I am most proud that SPARC can help scoliosis patients by significantly reducing the risk of needing spinal surgery through early detection and tracking the severity of scoliosis. In particular, severe scoliosis requires surgery, which can interfere with school, work, and requires a long healing process that can take 6 months to 1 year.

Thank you for checking out SPARC! :)

  • 3 devlogs
  • 11h
Try project → See source code →
Open comments for this post

8h 54m 46s logged

Hi! This time I finished the actual website for SPARC!
First I want to acknowledge that this devlog was made for a significantly longer time than my previous devlogs as I had the wrong approach at the beginning and had to learn to use a new framework.
—Brief Summary–––––––––––––––––––––––––
At the beginning, I had the false belief that I would only need to use HTML, CSS, and JS for this website, but eventually I realized that I had to use Python, in particular the Flask framework. I first altered my designs, reorganized my files, and fixed multiple bugs and typos in my code. I created the informative pages of SPARC that provided a perspective on scoliosis treatments and overall information about the website. After learning Flask, I made a dashboard page that allowed the user to save and create sessions. Each session requires the user to upload an image of someone’s back or use a sample image to see the results. It displays the model’s output of the image with the spine points, in addition to hip tilt, shoulder tilt, and the severity of the scoliosis. This analysis required me to make multiple mathematical calculations with different approaches while maintaining the accuracy of the measurements.
–In Detail—————————————————————
I began the website part of this project with the idea that I would use HTML, CSS, and JS, languages that I have previously used. In regards to the website design, I created an outline of my website on Canva and then found background images and icons online. However, midway into programming the website, I found out from resarching similar projects that I could not integrate the AI model with just HTML, CSS, and JS.  At that time, I was planning to make another devlog, but I wanted to make some actual progress first, so I continued on. I also changed my design by adding more features, which I believed would enhance SPARC.
I began to learn how to use python, in particular the framework Flask for the first time. While transitioning to Flask, I had to reorganize my files and change the file paths. During my reorganization, I discovered I had errors such as typos and bugs in my CSS and JS :(( I created multiple informative tabs such as the Home, About, Info, and Guide pages. All of the text there is written by me, using my experiences, and credible sources such as Shriners Children’s, a nonprofit healthcare system. I tried to provide a personal perspective for people affected by scoliosis.
Finally for the dashboard page, I was able to load the model and allow it to process images on the website using Python. I also used a database to allow the user to make multiple sessions that could be saved. Each session allows the user to upload images of a person’s back or use the sample images, and view the resulting image of the spine points that the model outputs. I was really excited for this part of the project as I was able to use my knowledge of Math as I experimented with ways to use the model’s output coordinates to provide a conclusion regarding the measured severity of the patient’s scoliosis, hip tilt, and shoulder tilt. I had to be careful in this step as I didn’t want external factors such as how close the patient was to the camera to affect the accuracy, so I used the formula (maximal deviation) / (spine length) and used the sample images as guidelines. To calculate the maximal deviation, one formula that I had to use was the point to line formula (distance from (x0, y0) to line ax+by+c=0 is |ax0+by0+c|/sqrt(aa+bb)).
For the deployment, I spent a really long time trying to deploy it for free on Python Anywhere, but no matter what memory optimizations I made, it still surpassed the disk limit :((( I was really disappointed and had wanted this model to be available for everyone to try online, but obviously anyone can still access it by cloning the Github project and running it locally. (instructions are in the readme)

0
0
8
Open comments for this post

2h 13m 45s logged

Welcome to my second devlog for SPARC!

–Finished Phase—————–
I just finished training the AI model to accurately identify points along the spine of a human on an image of their back. Originally, I planned to use the Scoliosis.v5i.yolov8 dataset, which I obtained from Roboflow; however, I had to switch to a much larger and more effective dataset that had ~400 images for training.
In total, I trained the larger dataset a total of 6 times on my CPU, with varying amounts of epochs each time.
Overall, this training phase required a lot of experimentation with the number of epochs (times the model goes through the entire dataset), as I was looking for high accuracy, but wanted to avoid overfitting. In particular, I didn’t want the AI model to train on the data too many times as it would eventually start memorizing the dataset instead of actually learning to identify the points.
In addition to training the model, I also tested it with a total of 30 images after each training session. During these testing phases, I discovered that the model works the best on images with sufficient lighting and relatively large image size.
Although this phase was sometimes frustrating as I had to train the model over and over again based on the results I obtained from testing it on images, it was extremely fufilling as I was able to achieve an Pose mAP50 of 0.84, which is better than I had expected after having so many failed attempts!

–Next Phase———————
Next, I will create a website that will allow users to test my model with images of their own, and potentially, their camera.
To add on to the website’s features, I will create a Math formula to classify the results of the image as normal, mild scoliosis, moderate scoliosis, or severe scoliosis.

–Image Description–––––––
The attached image shows one of my best results of the model on an image I found off the internet.

0
0
6
Open comments for this post

19m 46s logged

Hi! My name is Sophia, and this is my first devlog for SPARC!

––My overall plan for this project–––––––––––
My plan for this project is to train an AI model to be able to predict whether or not a person has scoliosis, and the severity of the scoliosis based on a picture or video of their back.
After training the model, I would like to create a website that people can visit to measure the severity of their scoliosis with simply their webcam.
In the future, I would like to track the measurements in a log and create a graph that will show the changes in the scoliosis measurements.

—Current Phase+Progress———————————–
Right now, I am working on training the model, testing it, and analyzing its accuracy. In particular, I want the model to find the coordinates of 10 points along the spine that I can use to calculate the deviation and the severity of the scoliosis.
I first learned about how to use YOLOv11n, a pretrained model, from https://docs.ultralytics.com/tasks/pose#train.Afterwards, I downloaded a dataset that the AI can train on from Roboflow.
Then, I set up and activated a virtual environment to prevent dependency conflicts, and installed ultralytics to use YOLO and PyTorch.
After coding up a python program, I was able to train the model for 20 epochs (each one complete pass through the dataset) on a very small dataset of ~50 training images. When I tested the model on an image, its predictions were inaccurate and had low confidence levels. It even detected the person’s back multiple times and made multiple predictions…
I realized that this dataset was too small, so I switched to a larger dataset of ~400 images, and am continuing to train my model until it is able to accurately detect the points along the spine.

0
0
26

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…