Close Menu
    Trending
    • STOP Building Useless ML Projects – What Actually Works
    • Credit Risk Scoring for BNPL Customers at Bati Bank | by Sumeya sirmula | Jul, 2025
    • The New Career Crisis: AI Is Breaking the Entry-Level Path for Gen Z
    • Musk’s X appoints ‘king of virality’ in bid to boost growth
    • Why Entrepreneurs Should Stop Obsessing Over Growth
    • Implementing IBCS rules in Power BI
    • What comes next for AI copyright lawsuits?
    • Why PDF Extraction Still Feels LikeHack
    AIBS News
    • Home
    • Artificial Intelligence
    • Machine Learning
    • AI Technology
    • Data Science
    • More
      • Technology
      • Business
    AIBS News
    Home»Machine Learning»Evaluating Traditional Computer Vision Models for Automating Sleep Staging with Single-Channel EEG Spectrograms | by Brunomalta | Feb, 2025
    Machine Learning

    Evaluating Traditional Computer Vision Models for Automating Sleep Staging with Single-Channel EEG Spectrograms | by Brunomalta | Feb, 2025

    Team_AIBS NewsBy Team_AIBS NewsFebruary 9, 2025No Comments7 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    . Understanding EEG and Spectrograms in Sleep Stage Classification

    .EEG and Sleep Patterns

    .Methodology

    .Switch studying and laptop imaginative and prescient fashions

    .Analysis

    .Conclusion

    The human mind is a posh organ {of electrical} exercise that communicates by means of intricate patterns of neural oscillations. These neural oscillations come up from the depolarization of neurons, making a distinction in potential, thus producing a stream of bioelectrical indicators. To decode these indicators, scientists and clinicians depend on the EEG (electroencephalogram), a non-invasive instrument that captures the mind’s electrical indicators through electrodes positioned on the scalp.

    EEG has turn out to be a cornerstone in neurology and neuroscience, providing insights into situations like epilepsy, sleep problems, and cognitive processes (reminiscent of evoked potentials) in addition to brain-computer interface analysis. By measuring voltage fluctuations ensuing from neuronal exercise, EEG offers a dynamic window into mind operate, revealing rhythms that correlate with the whole lot from deep sleep to targeted consideration.

    Nevertheless, uncooked EEG indicators alone could not at all times present ample info for scientists and technicians. In some instances, it’s essential to investigate how frequency content material adjustments over time. Utilizing a method often called the Brief-Time Fourier Rework (STFT), we are able to break down EEG indicators into their frequency elements, primarily making use of a type of “reverse engineering” to extract significant patterns. This methodology divides the sign into temporary segments, computes their frequency content material, and stitches them collectively right into a spectrogram — a heatmap the place brighter colours point out stronger exercise in particular frequency bands. This transformation helps convert summary waveforms right into a extra intuitive, visible illustration of how mind exercise evolves over time.

    The ten–20 system with front-back (nasion to inion) 10% and 20% electrode distances — https://info.tmsi.com/blog/the-10-20-system-for-eeg-

    Sleep technicians use EEG as the first instrument for staging a affected person’s sleep. Sleep staging is essential for a wide range of causes, together with diagnosing sleep apnea, sleep-related epilepsy, and parasomnias. There are a number of functions for sleep staging in each medical and analysis settings.

    Following the AASM (American Academy of Sleep Medication) pointers, sleep technicians classify sleep into distinct phases: wakefulness, non-REM (N1, N2, N3), and REM sleep. Every stage is characterised by distinctive EEG signatures, starting from the sluggish, excessive amplitude delta waves (0.5–2 Hz) of N3, also referred to as “slow-wave sleep,” to the speedy, desynchronized exercise of REM sleep.

    In principle, by making use of spectrogram evaluation to EEG indicators from every sleep stage, we must always have the ability to determine distinctive or not less than attribute patterns for various sleep phases. Which means as a substitute of analyzing the uncooked EEG waveforms, we might classify sleep phases solely primarily based on the distribution of frequency over time. For instance, throughout REM sleep, we’d observe bursts of beta and theta frequencies, making a mixed-frequency sample, whereas throughout N3 sleep, we’d see high-amplitude delta waves at decrease frequencies.

    N3 Spectogram
    REM spectogram

    In these spectrograms, which characterize totally different sleep phases from the PSG dataset used, we are able to clearly see the variations within the depth of frequencies (the “quantity” of a particular frequency) over time. Within the REM spectrogram, there’s a combination of frequencies, whereas in N3 sleep, there’s a distinct sample dominated by delta frequencies all through all the epoch.

    The X-axis (Time) represents time development, starting from 0 to 3000 ms (100 Hz sampling x 30 seconds per epoch). The Y-axis (frequency) reveals the frequency vary of the EEG sign, with values from 0 to 30Hz. The third dimension, colour, represents the facility (depth) of the sign at totally different frequencies over time.

    The info used is a open supply dataset (Sleep- EDF Database Expanded)

    – https://www.physionet.org/content/sleep-edfx/1.0.0/-

    With 197 whole-night PSG recordings containing EEG, EOG, chin EMG and occasion markers. All of the information are in EDF format.

    Observe : I solely used Pz-Ozchannel.

    For preprocessing the information, I used the MNE-Python library. This library was primarily used for studying the EDF (uncooked EEG) information and making use of filters to the sign.

    I utilized a bandpass filter (0.5–40 Hz) and a notch filter to take away environmental noise, reminiscent of potential electrical interference.

    Subsequent, I filtered the EEG information to incorporate solely the sleep interval utilizing the Sustained Wake After Sleep Onset (SWASO) methodology. I outlined a variable referred to as “sustained_wake_threshold”, and if the wake length surpassed the edge (in seconds), that phase was filtered out as wake time.

    Since sleep phases N3 and N4 have been outlined individually within the Rechtschaffen and Kales (R&Ok) scoring system, I needed to preprocess the information by merging N3 and N4 right into a single N3 stage. Moreover, motion epochs have been thought of wake phases.

    I created a operate to save lots of spectrograms for every particular person epoch, assigning them the corresponding label.

    Because the important aim was to make use of this information instantly with pre-trained conventional laptop imaginative and prescient fashions, I needed to resize and convert the spectrogram arrays into PIL format pictures. This course of, in fact, has some implications, reminiscent of lack of info from the unique EEG information. Nevertheless, given the {hardware} limitations (32 GB RAM and an RTX 3070 with 12 GB VRAM), this was the one possible strategy to run the fashions on every epoch.

    I had to make use of multiprocessing strategies to hurry up the processes by using extra CPU energy, as with out it, the duties would take an excessive amount of time. Particularly, I used ThreadPoolExecutor() from the concurrent.futures module. Ultimately, I generated 115K spectrograms to be used with the fashions.

    My important aim was to automate sleep stage classification utilizing spectrogram pictures from EEG information (Pz-Ozsingle-channel). To realize this, I made a decision to make use of switch studying with pre-trained convolutional neural networks (CNNs) — particularly EfficientNet, DenseNet, VGG, and Inception. These fashions have been initially skilled on ImageNet.

    Switch studying could be utilized in a number of methods. We will freeze all layers and prepare solely the output layer, unfreeze elements of the structure, or retrain all the mannequin whereas protecting the unique structure. In my case, I retrained the final blocks of the networks, to attempt to be taught some options from the spectograms itself. Since these fashions anticipate an enter dimension of 224 x 224, I resized the spectrogram pictures and standardized them utilizing the statistical parameters of the ImageNet dataset.

    I divided the dataset by prepare, validation and take a look at ( 80%/10%/10%).

    Because the dataset had an imbalance within the labels (45% of the labels have been labeled as N2, which is predicted given the context of sleep staging), I primarily used the F1 rating to judge the fashions. After working a set of 20 epochs, I obtained the next outcomes.

    This means a scarcity of characteristic studying within the remaining layers and a divergence between the dataset used for coaching on ImageNet and the spectrogram information. As a substitute of focusing solely on the poor outcomes, we are able to additionally assess the quantity of overfitting throughout all of the fashions.

    That is an instance of overfitting in a mannequin like ResNet18, the place the validation loss will increase whereas the coaching loss decreases.

    Permitting the mannequin some ‘freedom’ to be taught from the photographs can, in principle, enhance its studying capability. Nevertheless, there are just a few points. These embody information preprocessing (which may result in some lack of info), utilizing a single-channel EEG, and the character of the fashions themselves (conventional laptop imaginative and prescient fashions). With this in thoughts, I’d argue that utilizing these fashions with switch studying might not be the very best method for automating sleep staging — not less than when utilizing spectrograms with single-channel EEG.

    https://www.physionet.org/content/sleep-edfx/1.0.0/

    https://medium.com/@neurotist/unleashing-the-power-of-python-and-mne-a-guide-to-rereferencing-eeg-data-5e41988dc98a

    https://aasm.org/

    https://info.tmsi.com/blog/the-10-20-system-for-eeg



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleCyberattack Disrupts Publication of Lee Newspapers Across the U.S.
    Next Article Book Flights for Less with Matt’s Flights
    Team_AIBS News
    • Website

    Related Posts

    Machine Learning

    Credit Risk Scoring for BNPL Customers at Bati Bank | by Sumeya sirmula | Jul, 2025

    July 1, 2025
    Machine Learning

    Why PDF Extraction Still Feels LikeHack

    July 1, 2025
    Machine Learning

    🚗 Predicting Car Purchase Amounts with Neural Networks in Keras (with Code & Dataset) | by Smruti Ranjan Nayak | Jul, 2025

    July 1, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    STOP Building Useless ML Projects – What Actually Works

    July 1, 2025

    I Tried Buying a Car Through Amazon: Here Are the Pros, Cons

    December 10, 2024

    Amazon and eBay to pay ‘fair share’ for e-waste recycling

    December 10, 2024

    Artificial Intelligence Concerns & Predictions For 2025

    December 10, 2024

    Barbara Corcoran: Entrepreneurs Must ‘Embrace Change’

    December 10, 2024
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    Most Popular

    How DeepSeek Transformed My First Sentiment Analysis Project | by Ogho Enuku | Jan, 2025

    January 30, 2025

    Her Business’s $300 Product Combats $12 Billion Porch Theft

    January 30, 2025

    mzwhs

    March 21, 2025
    Our Picks

    STOP Building Useless ML Projects – What Actually Works

    July 1, 2025

    Credit Risk Scoring for BNPL Customers at Bati Bank | by Sumeya sirmula | Jul, 2025

    July 1, 2025

    The New Career Crisis: AI Is Breaking the Entry-Level Path for Gen Z

    July 1, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2024 Aibsnews.comAll Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.