Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

URA-1 IITRAM, 2023 1

Extended Abstract: Classification of CAP Phase A and B


Using 2-D CNN
Extended Abstract
Ashutosh Kumar Jha(3rd Year EECS)
Guided By: Dr. Manish Sharma
Department of Electrical and Computer Science Engineering
IITRAM, Ahmedabad

I. BACKGROUND

D URING sleep, the brain oscillates between two major


states, rapid eye movement (REM) and the non-REM
(NREM). Cyclic patterns of REM and NREM define the
sleep macrostructure, organized in discrete levels that are
directly related to sleep deepness. A relevant microstructure
phasic event, defined in NREM sleep, is the cyclic alternating
pattern (CAP), characterized by cycles of an activation (A
phase) phase followed by a quiescent (B phase) phase. Each
phase duration can vary between 2 and 60 s. A non-CAP
period occurs when the duration of the phases is higher
or lower than the specified one and a CAP sequence is a
succession of two or more CAP cycles. The mean duration of
a CAP sequence, in healthy adults, is estimated to be 2 min
and 33 s, composing an average of 5.6 CAP cycles, having
Fig. 1. Weigner Ville Distribution For Phase A
each cycle a mean duration of 26.9 ± 4.1 s.

Studies have indicated that CAP is a relevant process to


is related to higher values of CAP rate; therefore, CAP is the
generate, consolidate and disrupt the sleep macrostructure.
EEG marker of sleep instability and measures the effort of the
The CAP rate is defined by the ratio of the total CAP
brain to maintain sleep. CAP cycles have been associated with
time, in NREM sleep, to total NREM sleep time. When
sleep apnea, bruxism, insomnia, periodic limb movements,
sleep is disturbed, by induced vigilance instability, the CAP
restless leg syndrome, idiopathic generalized epilepsy, and
rate increases. Hence, there is a temporal relation between
nocturnal frontal lobe epilepsy. Therefore, detecting CAP is
autonomic functions, behavioral activities, and CAP. A
very essential in today’s world. But for a specialist, it’s become
poorer sleep quality is related to higher values of CAP rate;
very difficult to manually detect the CAP in a person as
therefore, CAP is the EEG marker of sleep instability and
it takes them to study 8-9 hours of EEG signal(i.e.entire
measures the effort of the brain to maintain sleep. CAP cycles
night). According to Rosa et al, the specialist agreement,
have been associated with sleep apnea, bruxism, insomnia,
analyzing the same EEG results, is in the 69–78% range. So,
periodic limb movements, restless leg syndrome, idiopathic
it’s important to develop an algorithm that can detect the CAP
generalized epilepsy, and nocturnal frontal lobe epilepsy.
in a signal more efficiently than the Specialist.
Therefore, scoring CAP is significant for the characterization
and diagnosis of such pathologies.
III. M ETHODOLOGY
A large quantity of information is produced during a full
The CAP Sleep Database from Physionet was used to test
night of EEG sleep, making the task of manually scoring
the algorithms.
all the CAP cycles unpractical, with a high probability of
miss classification. Consequently, the specialist agreement, We train our model on the data of 1st normal pa-
analyzing the same EEG results, is in the 69–78% rangeand tient(i.e..n1.edf) After Preprocessing of data, we get Phase A
automatic CAP detection algorithms have been proposed to epoch of size(1915*1024) and Phase B epoch of (4788*1024).
address this issue. We apply Weigner-Ville Distribution on these sampled values
of Phase A and B. It is a great tool that provides excellent
localization in time and frequency, unlike short-time Fourier
II. M OTIVATION transform, which can provide localization in either time or
In today’s world, the CAP is one of the important phenom- frequency, not both simultaneously. The programming envi-
ena in the brain. Various studies show that poorer sleep quality ronment MATLAB (The Math-works Inc.) and Google Colab
URA-1 IITRAM, 2023 2

The batches are then passed through 3 layers of Convolu-


tion neural network(CNN) and 5 layers of Neural Network
including three hidden layers.

Fig. 2. Weigner Ville Distribution For Phase B

were used to produce the analysis, importing the EEG signals.


Fig. 4. 2-D CNN Architecture

We have Thirteen Lakhs Eighty-Seven Thousand and Nine


Hundred Eight Parameters to train and then with the help of
these trained Parameters, we can classify a signal into Phase
A or B.

IV. R ESULTS

We test on 400 matrices of size(255*255*3) and the model


classifies them in either Phase A or Phase B. [h] From The

Fig. 3. Flowchart depicting given Algorithm to identify CAP

As we see above by applying the WVD function in Matlab


on Phase A and B matrix, it generates localization of time and
frequency in an image for each row. So, we have 1915 rows
of Phase A and 4788 rows of Phase B. As we can clearly
see the above data is biased so to remove this bias we apply
various methods from data augmentation, and data removal
to generate the WVD for 2 and 4 Second of Phase A and B
respectively. But we get the best result in Data Augmentation
of Phase A and removal of Phase B.
The image generated by WVD is then converted to a Matrix Fig. 5. Confusion Matrix Of Test Data
using the OpenCV library of Python. The size of the matrix
varies depending on the resolution of the images. We resize Confusion Matrix, We can clearly see that there are 164 True
all matrices in the same shape (i.e.(255*255*3)). The data and Negative (TN) data and 54 False Negative(FN). Similarly, we
its label are then divided into batches. The batch consists of have 132 True Positives (TP) and 4 False Positives (FP).
random images of both the A and B phases. We select the Sensitivity = TP/ (TP+FN).
Batch size to be 70. So our data is divided into 55 classes. Specificity = TN/(TN+FP) .
We select 70% of the above batches (i.e.38 batch) for training, So by the above Confusion Matrix, We get to know the
20% of the above batches (i.e.11 batch) for validation, and Accuracy, Sensitivity, and Specificity are 83.38%, 70.96%,
10% of the above batch(i.e.6 batch) for testing. 97.04%
URA-1 IITRAM, 2023 3

Author ACCURACY% Sensitivity % Specificity %

Mendonça F et al 79 76 80

Machado F et al 76 77 79

Dhok S et al. 72.35 76.76 69.19

Loh H et al. 73.64 80.29 66.95

Our Result 83.38 70.96 97.04


TABLE I

V. C ONCLUSION
The goal of this work was to develop algorithms capable of
detecting the CAP phases, using a classifier to determine the
A and B phases. It was verified that the developed algorithms
have a higher performance than most of the algorithms that are
in existence. According to Rosa et al, the specialist agreement,
analyzing the same EEG results, is in the 69–78% range.
Therefore, the attained results with the 2D -CNN are above
the average specialist agreement, indicating that the presented
algorithms could be useful for medical diagnosis.

You might also like