Artifact Detection Chronicles

Published on August 4, 2025

By Elijah Ghossein

You're reading part 1 of the series Artifact Detection Chronicles

The Beginning

Since the beginning of time (more like a bit after 1924, when Hans Berger invented the first electroencephalogram (EEG)), scientists have been concerned with artifacts in brain signals. Artifacts are things like eye blinks, heartbeats, muscle movements, etc., that show up in EEG recordings because they create electrical potentials that are usually much stronger and can travel much farther than those of the neuron populations that we actually care about. It’s like talking to someone at a loud party, where sometimes you give up on trying to have a meaningful conversation and just try to enjoy someone else’s bad taste in music.

Raw vs. clean EEG data

Even though there are much more sophisticated brain imaging techniques that are not affected by artifacts or powerline noise at 60 Hz in the U.S. and 50 Hz in Europe (watch out for your notch filters), EEG remains one of the fastest and cheapest windows into the brain. And so, over the years, many different signal processing methods have been crafted to clean EEG signals. One of the most effective techniques is Independent Component Analysis (ICA), which can separate any signal into the components that make it up. This is great news for artifact removal! Now you can break a signal down into all the pieces that make it up, delete the ones you don’t like, and put back together the signal with only the brain waves. Hold on...nothing is that perfect. A few downsides to ICA are that it’s super slow, needs large segments of data to make accurate decisions, and is known to delete some neural data along with bad components.

Strokes

Why is this all important? We’re currently interested in developing a method to detect acute ischemic strokes in real time using EEG, and analyzing clean brain signals would make that task a lot easier. But of course, after a long Discord call, we all agreed that cleaning in real time with standard methods would probably tell a person they were having a stroke by the time they already made it to the CT scan (that’s dramatic, but you get the point). So we started thinking outside the box and said: “You know what, it would be nice if we didn’t have to clean.” What if you could look at a dirty signal and know that a stroke was happening?

Posterior cerebral artery (PCA) infarction

As long as the person whose EEG is being recorded isn’t breakdancing, we can mostly guarantee that there won’t be an artifact in every second of the signal. This means that if we were to only focus on the segments of the signal that didn’t have artifacts, we could potentially analyze them and come to a conclusion about whether or not a stroke is beginning in a certain part of the brain. Trained neuroscientists are quite good at visually inspecting a signal and labeling artifacts, and many labeled open-source EEG datasets are put together by expert labelers. What we need, to solve the first part of our problem, is a little neuroscientist who is working doubles in real time, telling us what not to analyze for strokes. So of course, we turned to machine learning (ML), specifically, to build an artifact detection model.

Artifact Detection

To train a model to do this tedious job, we’re going to need a LOT of data. Thanks to Alex for downloading the Temple University Hospital (TUH) Artifact Corpus, which has hundreds of artifact-labeled EEG recordings, and for putting together a Python script called mneprep.py, which properly loads in the Temporal Central Parasagittal (TCP) Averaged Reference (AR) montage that uses longitudinal bipolar channels (fancy words that just mean each pair of electrodes is average-referenced instead of single-referenced). Now that we had 6 GB of brain data loaded, Arsam and I could build a model and give it a go. This is what this series will be about.

Views: 909

Leave a Comment

Comments

kaylavelasc

about 1 year ago

Great article! Explained very well.