About Me: Come explore the world of AI
The world is progressing. With more data, artificial intelligence systems have increased the efficiency of work tasks intensely and opened the doors to the future.
As someone that has worked on various AI projects for more than four years, such as rotten fruits detection for global farmers who lose profit, self-playing AI snake game, an automatic attendance system for schools, detection of who is following the COVID-19 six feet apart regulations, and more, I have invested myself in the biggest project I have done yet.
However, before we get to that, I would like to start from when I first started programming. I was on the robotics team in middle school; even though I could not find my niche or place in anything, I found coding. I was able to throw myself in software endeavors to contribute. When trying to decide what could enhance the robot’s performance greatly, my interest in artificial intelligence sparked.
As of now, I am currently working on a project to detect and localize pain using fMRI (functional magnetic resonance imaging) data.
My idea is that veterans that come back from war will not be able to convey pain reactions due to PTSD and other mental conditions. Therefore, being able to create a device that uses brain imaging to massage a specific area of the body that is feeling pain will help the veterans cope with tremendous war injuries.
Three different stages are evident here: the first part was being able to detect whether there was pain or not, the second part was being able to designate the area of pain on the body, and lastly, a hardware device should be able to help the person cope with the pain.
I, who was completely oblivious and unexperienced in the field of neuroscience, used EEG (electroencephalography) signals, before consulting an Inspirit AI instructor about what format of data I should use for the project, to which he responded that fMRI images would work the best.
Finding data was not easy; once I finally found that data from OpenNeuro, I still had problems with the multi-dimensional data (4D brain images), the size of the data — which I had to preallocating arrays and uncache variables to have enough memory to operate the program, preprocessing the fMRI data, determining which types of machine learning models, hyperparameters, and dimensionality reduction would work best for the project as a whole.
Dimensionality reduction to 2D was intuitive:
Dimensionality reduction to 3D was not as visible or computationally efficient:
In addition, I tried to correlate the different parts of the brain.
Following the grueling process of preprocessing the data, I finally trained the accuracy to ~68% with a 3D CNN model and ~80% with a 2D CNN Model.
In order to increase the accuracy, I tried tweaking the hyperparameters such as the optimizers, epochs, learning rate, and regularization functions.
However, I was able to get a working demo by connecting up a relay from a RaspberryPi to a HAUSBELL massager, and created two Python Flask servers — one on my computer and one on the RaspberryPi itself. When I sent the fMRI images through my website server, my machine learning model was able to turn the massager on if its prediction detected pain and was able to turn it off if the prediction did not detect it.
Since the network architecture was complex, I implemented surrogate models for explainability. The image below indicates what features of the brain the model is learning to train on.
I tried it out on my family members, and they said it was “very nice and relaxing.”
I am still trying to figure out what measures I should use to increase the accuracy of my model, and hope to get more help and advice from the AI community, as well as put my two cents in for others’ issues.
Much like how I am trying to improve, artificial intelligence will improve.
Jeremy Lu is a Student Ambassador in the Inspirit AI Student Ambassadors Program. Inspirit AI is a pre-collegiate enrichment program that exposes curious high school students globally to AI through live online classes. Learn more at https://www.inspiritai.com/.