Code for Depression Recognition by Deep Learning

$0.00

Total downloads: 8

This Python code helps to detect depression using EEG signals. A stacked LSTM-CNN deep learning model is developed and coded in python for it. The classification accuracy of 84% is achieved by this code.

This repository includes:

  • Python (jupyter notebook) code for depression detection by EEG

Disclaimer: This python code is uploaded on the free-thesis.com by a supporter. We admire and appreciate her support and belief to share the research codes for free.

 Discuss Code

Description

Highlights for Depression Recognition by Deep Learning

  • An RNN (i.e. LSTM) based Deep Learning model has been  modeled for the identification of depression.
  • The computer-aided techniques based on neural networks predominately work on EEG as a biomarker for depression analysis.
  • The authors’ model is an LSTM structure that has been layered.
  • The EEG signals   are recorded at a sampling rate of 500 Hz using a total of 64 scalp electrodes.
  • The data is preprocessed for artifacts removal and windowed into a chunk of 8 secs.

Introduction

You are reading this article on depression recognition by deep learning and will download the free code at https://free-thesis.com. Like the rest of the globe, India has observed an upsurge in mental health cases during the pandemic. Several suicides have been linked to the elevated anxiety and terror caused by COVID-19. SARS and other pandemics unquestionably impacted people’s mental health at some time. It is difficult to interpret electrical data manually, thus the brain’s activity is recorded in milliamperes (mA). Depressed people have a hemispheric asymmetry in their thought signals, which means that EEG may detect that unusual activity.

For the purpose of minimizing problems and accurately analyzing depression circumstances, the authors of this paper have examined the most modern machine learning algorithms. The approach uses EEG data to check for depression using a computer or artificial intelligence. Three levels of stacked LSTM networks are used to extract the features at the highest level. Advanced approaches including data mining and Deep Neural Networks, Recurrent Neural networks (RNN), and Convolution Neural Networks (CNN) have emerged in recent years (CNN).

DeepNet (Stacked Deep Learning Model)

Neural network methods, which are becoming increasingly popular, are used in the bulk of computer-aided EEG screening procedures. Even when the data is insufficient for an extended period of time, the learning process with and without feedback is critical. This difficulty can be alleviated using the LSTM approach. As seen in figure 1, the model developed by the authors is a multi-layered LSTM structure.

The complete designed model for primarily screening of depression based on EEG-free-thesis
Figure 1: The complete designed model for primary screening of depression based on EEG

Feature extraction using 1D convolution and Dropout Layer

Features may be extracted using the approach of convolution, which is commonly utilized. It’s known as a Conv 1D layer if the operation is only done in one dimension (conversion in one dimension). To generate a kernel (weighted fitter) that slides over the input signal, the shift-compute process, or shift-fitter approach, is performed. It’s possible that the procedure is accidental or not. In this implementation, the author has used a non-casual convolution process.

The stacked structure of the proposed model

The suggested model uses three layers of LSTM layers. The following table provides a comprehensive breakdown of the model’s several layers: The input data vector is first convoluted, and then an activation function, which is the ReLU layer, is applied. Layered LSTM structures are piled on top of each other in the following three levels. The classification layer’s output neurons are included in the last three levels of consideration. The model is able to fulfill its goal using the Adam optimizer, which is a stochastic gradient descent technique with a learning rate of 0.001.

Stacked CNN LSTM layers & parameters-free-thesis
Stacked CNN LSTM layers & parameters-free-thesis

Performance Analysis

EEG signals taken for study in this work are taken from the analysis carried out in the psychology department, University of Arizona, USA. The complete designing and comparison of the model of screening model are carried out Colaboratory, also known as “Colab” popularly. The data has been bifurcated into training, validation, and testing with a ratio of 70% for training, and the rest 30% are again divided into 20% for validation and
10% for testing. With this ratio, there are 9428 EEG records for training and 2563 and 1000 for validation and testing respectively. The model has been tested for 10% of the untrained dataset. The dataset has been randomly shuffl to avoid the bias conditions. The accuracy achieved by the model is 84% for an epoch of 100 as shown in the Fig.2. While the model loss is around 0.35% as evident from the Fig.3. The model has taken 59 ms to complete an epoch of 100 with the testing conditions. Precision and recall values recorded are 85% and 80% respectively. Through these values, we can analyze the power of stacked LSTM memory cells. The model has exploited two main aspects of the structure that low complexity as compared to the other existing model with a comparable accuracy due to the inherent ability of the staked LSTM layer.

EEG signal of a healthy person-free-thesis
EEG signal PSD of a healthy person-free-thesis
EEG signal of a depressed person-free-thesis
EEG signal of a depressed person-free-thesis
Stacked LSTM CNN Model losses for Depression Detection-free-thesis
Stacked LSTM CNN Model losses for Depression Detection-free-thesis
Stacked LSTM CNN Model Accuracy for Depression Detection-free-thesis
Stacked LSTM CNN Model Accuracy for Depression Detection-free-thesis

Conclusion

Stacked LSTM structures are introduced in the model for depression identification. The stacking not only increases the model’s capacity to extract features, but also its ability to forecast. A total of 45 patients’ data has been used to test the model (24 normal and 21 depressed). With a false positive rate of 0.07 percent, the model achieves a classification accuracy of 84%. The authors want to introduce the ensemble notion to increase the model’s accuracy, which is currently at an early stage.

Similar Other Work available on https://free-thesis.com

Multi Exposed Image Fusion using Deep Learning

Published Paper similar to this work

  1. Ranjani, M., and P. Supraja. “Diagnosing Mental Disorders based on EEG Signal using Deep Convolutional Neural Network.”
  2. Chen, Xun, Chang Li, Aiping Liu, Martin J. McKeown, Ruobing Qian, and Z. Jane Wang. “Towards Open-World EEG Decoding via Deep Learning.” arXiv preprint arXiv:2112.06654 (2021).
  3. Zhang, Tao, Minjie Liu, Tian Yuan, and Najla Al-Nabhan. “Emotion-Aware and Intelligent Internet of Medical Things Toward Emotion Recognition During COVID-19 Pandemic.” IEEE Internet of Things Journal 8, no. 21 (2020): 16002-16013.
  4. Zhang, Xiaowei, Junlei Li, Kechen Hou, Bin Hu, Jian Shen, and Jing Pan. “EEG-based depression detection using convolutional neural network with demographic attention mechanism.” In 2020 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC), pp. 128-133. IEEE, 2020.
  5. Acharya UR, Oh SL, Hagiwara Y, Tan JH, Adeli H, Subha DP. Automated EEG-based screening of depression using deep convolutional neural network. Comput Methods Programs Biomed. 2018 Jul;161:103-113. doi: 10.1016/j.cmpb.2018.04.012. Epub 2018 Apr 18. PMID: 29852953.

 

 

6 reviews for Code for Depression Recognition by Deep Learning

  1. vishal.gupta (verified owner)

    thanks

  2. vishal.gupta (verified owner)

    thnk

  3. otuo.acheampong (verified owner)

    very useful website

  4. otuo.acheampong (verified owner)

    very useful website

  5. vishal.gupta (verified owner)

    very useful and helpful

  6. chou_aib (verified owner)

    Great

Only logged in customers who have purchased this product may leave a review.