[go: up one dir, main page]

0% found this document useful (0 votes)
36 views60 pages

SFM Major

The dissertation presents a project on automated pain recognition using physiological signals and deep learning techniques. It aims to improve pain assessment accuracy by leveraging multi-level contextual information and advanced models like CNN + BI-LSTM and BI-GRU. The study evaluates its effectiveness using datasets such as the BioVid Heat Pain database, demonstrating significant improvements over traditional methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views60 pages

SFM Major

The dissertation presents a project on automated pain recognition using physiological signals and deep learning techniques. It aims to improve pain assessment accuracy by leveraging multi-level contextual information and advanced models like CNN + BI-LSTM and BI-GRU. The study evaluates its effectiveness using datasets such as the BioVid Heat Pain database, demonstrating significant improvements over traditional methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 60

A Project report on

Pain Recognition With Physiological Signals Using Multi-Level Context


Information
A Dissertation submitted to JNTUH, Hyderabad in partial fulfillment of the
academic requirements for the award of the degree.

Bachelor of Technology
in
Artificial Intelligence and Machine Learning
Submitted by

R.Shiva
(21H51A7343)
SK.Fareed
(21H51A7344)
G.Madhu
(21H51A7349)

Under the esteemed guidance of


Dr .Y.Ambica
Asst.professor CSE(AI&ML)

Department of Artificial Intelligence and Machine Learning

CMR COLLEGE OF ENGINEERING& TECHNOLOGY


(UGC Autonomous)
*Approved by AICTE *Affiliated to JNTUH *NAAC Accredited with A+ Grade
KANDLAKOYA, MEDCHAL ROAD, HYDERABAD - 501401.

2024-2025
.
CMR COLLEGE OF ENGINEERING & TECHNOLOGY
KANDLAKOYA, MEDCHAL ROAD, HYDERABAD – 501401

DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING

CERTIFICATE

This is to certify that the Major Project Phase-1 report entitled "Pain
Recognition With Physiological Signals Using Multi-Level Context
Information" being submitted by R.Shiva (21H51A7343),
SK.Fareed(21H51A7344),G.Madhu (21H51A7349) in partial fulfillment for the
award of Bachelor of Technology in Artificial Intelligence and Machine
Learning is a record of bonafide work carried out his/her under my guidance and
supervision. The results embodies in this project report have not been submitted to
any other University or Institute for the award of any Degree.

Dr.Y.Ambica Dr. S.Kirubakaran


Asst.professor Professor and HOD
Dept.of CSE(AI&ML) Dept. of AIML
ACKNOWLEDGEMENT

With great pleasure we want to take this opportunity to express my heartfelt gratitude to all
the people who helped in making this project work a grand success.
We are grateful to Dr.Y.Ambica, Asst.Professor CSE(AI&ML) , Department of
Artificial Intelligence and Machine Learning for his valuable technical suggestions and guidance
during the execution of this project work.
We would like to thank Dr. S.Kirubakaran, Head of the Department of Artificial
Intelligence and Machine Learning, CMR College of Engineering and Technology, who is the
major driving forces to complete my project work successfully.
We are very grateful to Dr. Ghanta Devadasu, Dean-Academics, CMR College of
Engineering and Technology, for his constant support and motivation in carrying out the project
work successfully.
We extend our heartfelt gratitude to Dr.Seshu Kumar Avadhanam, Principal, CMR
College of Engineering and Technology, for his unwavering support and guidance in the
successful completion of our project and his encouragement has been invaluable throughout this
endeavor.
We are highly indebted to Major Dr. V A Narayana, Director, CMR College of
Engineering and Technology, for giving permission to carry out this project in a successful and
fruitful way.
We express our sincere thanks to Shri. Ch. Gopal Reddy, Secretary& Correspondent,
CMR Group of Institutions, and Shri Ch Abhinav Reddy, CEO, CMR Group of Institutions for
their continuous care and support
Finally, We extend thanks to our parents who stood behind us at different stages of this
Project. We sincerely acknowledge and thank all those who gave support directly and indirectly in
completion of this project work.

R. Shiva 21H51A7343
SK.Fareed 21H51A7344
G.Madhu 21H51A7349
Pain Recognition with physiological signals using Multi-Level Context Information

TABLE OF CONTENTS
CHAPTER
NO. TITLE PAGE NO.
LIST OF FIGURES ii
LIST OF TABLES iii

ABSTRACT iv

1 INTRODUCTION 1
1.1 Problem Statement 2
1.2 Research Objective 3
1.3 Project scope and limitations 4
2 BACKGROUND WORK 6
2.1.Automatic recognition methods supporting pain assessment 7
2.1.1.Introduction 7
2.1.2.Merits,Demerits and Challenges 7
2.1.3.Implementation of Intelligent tutoring System 8
2.2.The biovid heat pain database data for the advancement 9
2.2.1.Introduction 9
2.2.2.Merits,Demerits and Challenges 9
2.2.3.Implementation of Existing method 9
2.3.Affect recognition from naturalistic movement data 10
2.3.1.Introduction 10
2.3.2.Merits,Demerits and Challenges 10
2.3.3.Implementation of Existing Method 11
2.4.Centered continuous pain intensity assessment 11
2.4.1 Introduction 11
2.4.2 Merits, Demerits and Challenges 12
2.4.3 Implementation of Existing Method 12
3. PROPOSED SYSTEM 21

3.1. Research Objective of Proposed Model 22


3.2 Algorithms Used for Proposed Model 23
3.3 Designing 23
3.4 Stepwise Implementation and code 30

CMRCET B.Tech (AIML) PageNo i


Pain Recognition with physiological signals using Multi-Level Context Information
4. RESULTS AND DISCUSSION 37
4.1. Comparison of Existing Solutions 38

4.2. Data Collection and Performance metrics 41


5 CONCLUSION 43
5.1 Conclusion 44
6 REFERENCES 45

CMRCET B.Tech (AIML) PageNo i


Pain Recognition with physiological signals using Multi-Level Context Information

List of Figures
FIGURE
NO. TITLE PAGE NO.
2.1 Flow of data Diagram 16

CMRCET B.Tech (AIML) PageNo ii


Pain Recognition with physiological signals using Multi-Level Context Information

CMRCET B.Tech (AIML) PageNo ii


Pain Recognition with physiological signals using Multi-Level Context Information

List of Tables

FIGURE
NO. TITLE PAGE NO.
3.1 Literature survey . 15
3.3 Comparision of existing systems 38

CMRCET B. Tech (AIML)


PageNo iii
Pain Recognition with physiological signals using Multi-Level Context Information

ABSTRACT

In the medical field, automatic pain detection is crucial. Previous research has shown that
physiological signal characteristics are used preferentially for traditional models by automated
pain identification algorithms. These techniques work well, however they mostly depend on
medical knowledge to extract physiological signal features. Regardless of medical
background, this work proposes a deep learning strategy based on physiological signals that
play the roles of both feature extraction and classification.

We suggest including multidimensional contextual information for every physiological signal


that distinguishes between pain and absence of discomfort. Based on Part A of the BioVid
Heat Pain database and the Emopain 2021 dataset, our experimental findings demonstrate that
multi- level context information performs more substantially than uni-level context
information.

Our experimental findings for pain detection tasks include Pain 0 and Pain 1, Pain 0 and Pain
2, Pain 0 and Pain 3, and Pain 0 and Pain 4 for Part A of the BioVid Heat Pain database. In a
Leave-One-Subject-Out cross validation analysis, the classification task between Pain 0 and
Pain 4 yields average accuracy of 84.8 B1 13.3% for 87 patients and 87.8 B1 11.4% for 67
individuals. The suggested approach makes use of deep learning's superior performance over
traditional techniques while handling physiological inputs.

The author of the proposal used multilevel or two level feature selection algorithms, such as
CNN + BI-LSTM. In the extension work, we added three levels of feature optimization by
combining CNN + BI-LSTM + BI GRU. In this way, BI-STM will select the CNN optimized
features, and BI-GRU will select the BI-LSTM optimized features. Three level feature
optimization and selection contributes to increased accuracy.

CMRCET B. Tech (AIML)


PageNo iv
Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 1
INTRODUCTION

CMRCET B.Tech (AIML) Page 1


Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 1

1.1 PROBLEM STATEMENT

Current pain recognition methods rely heavily on subjective human observations,


leading to limitations in accuracy and reliability. Patients may intentionally control emotional
expressions, and individual personalities can influence pain behavior, making it challenging to
obtain consistent and objective assessments.

To address these issues, there is a pressing need for an automated pain recognition
system that leverages physiological signals to ensure more accurate and universal pain
assessment in the medical field.

CMRCET B. Tech (AIML) Page 2


Pain Recognition with physiological signals using Multi-Level Context Information

1.2 RESEARCH OBJECTIVE:-

The primary objective of this study is to develop an automated, deep learning-based pain
detection system that uses physiological signals for both feature extraction and classification,
eliminating the need for medical expertise in feature extraction. The study introduces the
concept of multi-level contextual information, which considers multidimensional features of
physiological signals to distinguish between pain and non-pain states.

The research aims to leverage advanced deep learning models, such as CNN + BI-LSTM and
extended versions like CNN + BI-LSTM + BI-GRU, to optimize feature extraction and
improve accuracy. Through multi-level feature optimization, the proposed system seeks to
outperform traditional methods while utilizing only physiological inputs for pain recognition.

The research evaluates the system's performance using two primary datasets—Part A of the
BioVid Heat Pain database and the Emopain 2021 dataset—and focuses on several
classification tasks (e.g., Pain 0 vs. Pain 1, Pain 0 vs. Pain 2, Pain 0 vs. Pain 3, and Pain 0 vs.
Pain 4). The goal is to demonstrate that multi-level context information and advanced deep
learning models can achieve higher accuracy compared to traditional uni-level methods,
offering a reliable, automated solution for pain detection in medical diagnostics.

CMRCET B.Tech (AIML) Page 3


Pain Recognition with physiological signals using Multi-Level Context Information

1.3 PROJECT SCOPE AND LIMITATIONS:-


Scope:
1.Automated Pain Detection:
The study proposes a deep learning-based framework for automatic pain detection,
eliminating the need for manual feature selection. It leverages physiological signals
like Electrodermal Activity (EDA) and Electrocardiogram (ECG) for pain assessment.

2.Multi-Level Feature Optimization:


The model integrates CNN, Bi-LSTM, and Bi-GRU to refine feature extraction and
classification. Three-tier optimization significantly improves accuracy over conventional
Methods.

3.High Accuracy in Pain Classification:


The model demonstrates enhanced classification performance with an accuracy of up to
99%, outperforming traditional methods like SVM and Random Forest.

4. Real-World Application in Healthcare:


The proposed system can assist healthcare professionals in assessing pain levels
objectively. It is beneficial for patients who cannot express pain, such as infants and
unconscious individuals.

5.Integration of Attention Mechanism:


The study introduces attention-based multi-level context modeling to enhance feature
selection.It effectively captures hidden sequential patterns in physiological signals.

6.Use of Benchmark Datasets:


The study utilizes standard datasets like the BioVid Heat Pain Dataset and EmoPain
2021, ensuring generalizability.

CMRCET B.Tech (AIML) Page 4


Pain Recognition with physiological signals using Multi-Level Context Information

LIMITATIONS:-
1.Dependence on Specific Physiological Signals:
The model primarily relies on EDA and ECG signals, which may not fully capture
pain perception in all individuals. Other signals like Facial Expressions, EMG
(Electromyography), and EEG (Electroencephalogram) could provide additional
insights.

2.Challenges with Noise and Artifacts:

Physiological signals are prone to noise and artifacts, which can reduce model
reliability.External factors such as stress, anxiety, or environmental conditions may
impact signal quality.

3. Dataset Constraints:
The BioVid Heat Pain Database and EmoPain 2021 focus on controlled experiments,
which may not fully reflect real-world clinical settings.The model's performance in
diverse, unstructured environments remains uncertain.

4. Computational Complexity:
The proposed CNN + Bi-LSTM + Bi-GRU model is computationally intensive,
requiring high processing power and memory.Real-time pain detection on low-power
embedded systems (e.g., wearable devices) may be challenging.

5. Limited Generalization to Chronic Pain:


The model is primarily tested for acute pain detection in controlled settings.
It may not perform well in detecting chronic pain, which has different physiological
characteristics.

6. Lack of Personalization:
Pain perception varies significantly between individuals based on age, gender, and
CMRCET B.Tech (AIML) Page 5
Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 2
BACKGROUND
WORK

CMRCET B.Tech (AIML) Page 6


Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 2
BACKGROUND WORK
2.1 Automatic recognition methods supporting pain assessment:

2.1.1 Introduction: Pain is a subjective experience that plays a vital role in healing but
becomes a significant issue when chronic, impacting individuals and society. Effective pain
assessment is crucial but challenging, especially for non-communicative patients. Traditional
methods often lack objectivity, leading to under- or overtreatment. Emerging automated pain
recognition systems, using behaviors like facial expressions and physiological signals, offer
the potential for continuous and unbiased monitoring, promising better pain management and
improved clinical outcomes.

2.1.2 Merits Demerits and Challenges:-


Merits:

 Promising Approaches:
o Progress has been made with multimodal systems combining different data
types.
o Utilization of weak and ordinal ground truth data with minimal annotated data
has shown success.
o Learning models are being personalized, and temporal contexts are being
leveraged for better accuracy.
 Improved Multi-Modal System Insights:
o Combining modalities such as audio and visual data has demonstrated potential
for enhancing sensitivity and specificity.
 Usefulness in Clinical Scenarios:
o Efforts are directed toward better clinical adaptation by addressing challenges

Demerits:

 High Complexity in Real-world Clinical Adaptations:


o Sensitivity, specificity, and robustness are limited in real-world applications.
 Small Dataset and Annotation Issues:
o Data collection and sharing are insufficient.
o Many models depend on limited datasets or weak labels.
 Unaddressed Factors:
o Certain pain types, such as chronic pain or aspects like pain quality and
location, remain underexplored.

CMRCET B. Tech (AIML) Page 7


Pain Recognition with physiological signals using Multi-Level Context Information

Challenges:

 Knowledge Gaps:
o Limited understanding of the physiology of pain and its measurable responses.
o Need to identify factors influencing pain responses and explore the interaction
between emotions and pain.
 Data and Validation:
o Insufficient availability of data from real clinical scenarios.
o Requirement for datasets with multimodal annotations and mechanisms to
control false signals.
 Algorithm and Hardware Improvements:
o Addressing inter-individual differences in pain responses.
o Enhancing the detection of low-intensity pain signals.
o Developing systems to manage artifacts and interference (e.g., lighting
changes, occlusions, motion).
o Tackling small datasets and data sparsity while ensuring model reliability.
 Real-Time Processing and Emotional Blending:
o Overcoming dependence on long-term data collection, which is impractical in
clinical settings.
o Differentiating pain signals from accompanying emotions using advanced
algorithms.

2.1.3 Implementation of Existing Method


(Automatic recognition methods supporting pain assessment) :

 Data Sharing and Multimodal Datasets:


o Develop and share multimodal datasets with comprehensive annotations to
enable comparative evaluations across diverse use cases.
 Improve Annotation Techniques:
o Utilize multiple ground truth sources, such as expert consensus or physiological
markers, to minimize label noise.
 Develop Cross-Setting and Generalized Algorithms:
o Validate algorithms on diverse datasets from both clinical and non-clinical
environments to ensure generalizability.
 Explore Advanced Modalities:
o Integrate underutilized data sources, such as audio signals (e.g., infant cries or
physiological audio responses), for richer contextual analysis.
 Real-Time Processing:
o Prioritize online pain recognition methods that operate without relying on full
sample distributions, enabling real-time detection.

CMRCET B.Tech (AIML) Page 8


Pain Recognition with physiological signals using Multi-Level Context Information
2.2 The biovid heat pain database data for the advancement and
systematic validation of an automated pain recognition system.
2.2.1 Introduction
The measurement of pain, a subjective and multi-dimensional experience, remains an unsolved
issue. Traditional methods like verbal scales, questionnaires, and visual analog scales lack
reliability and validity, especially for mentally impaired individuals. Coding systems that
utilize expressions of pain or biopotential parameters offer potential solutions but are costly,
time- consuming, or inadequately validated
2.2.2 Merits Demerits and Challenges:-
Merits:
 Provides an innovative approach to pain measurement using visual and biopotential

signals.
 Has potential for increased reliability and objectivity compared to traditional verbal
and visual scales.
 Facilitates automated pain recognition, reducing human intervention.

Demerits:
 Existing coding systems are costly and time-intensive.

 Insufficient validation based on mental testing theories.


 Challenges in ensuring reliability and performance optimization.

Challenges:
 Achieving adequate theoretical testing quality for automated systems.

 Optimization of system performance for accurate pain recognition.


 Addressing the reliability and validity issues inherent in traditional methods.
 Ensuring applicability to diverse populations, including mentally impaired individuals.
2.2.3 Implementation of Existing Method
 Collection of a comprehensive database using visual and biopotential signals.

 Subjecting participants to controlled painful heat stimuli for data acquisition


 Development and systematic validation of an automated pain recognition system.
 Focusing on optimizing performance and theoretical quality of the system.

.
CMRCET B.Tech (AIML) Page 9
Pain Recognition with physiological signals using Multi-Level Context Information

2.3. The affect move 2021 challenge—Affect recognition from


naturalistic movement data.

2.3.1 Introduction: The AffectMove 2021 Challenge was the first Affective Movement
Recognition (AffectMove) challenge, designed to bring together datasets of affective bodily
behavior from real-life scenarios to encourage research in affective computing. Despite the
relevance of movement-based models, automatic detection of naturalistic affective body
expressions lags behind other modalities. This challenge aimed to utilize existing body
movement datasets to tackle the problem of recognizing complex and naturalistic affective
behaviors, with a focus on three specific tasks based on real-life contexts and sensor data

2.3.2 Merits, Demerits and Challenges


Merits:

 Explores the intersection of real-life bodily behaviors and emotion detection.


 Allows participants to leverage multimodal data across datasets for improved
performance.
 Provides datasets (EmoPain, we Draw-l Movement, Unite-Maastricht Dance) for
different real-life contexts.

Demerits:
 The research in this area is still lagging compared to other modalities of affective

computing.
 Complexity of datasets from real-life scenarios creates challenges for analysis and
generalization.
 The challenge relies heavily on multimodal sensor data, which can complicate analysis

Challenges:
 Developing effective methods for recognizing naturalistic and complex affective

behaviors from movement. Generalizing findings across multiple datasets and


contexts.
 Addressing the variety and complexity of sensor types and data sets (multimodal data).
 Improving recognition performance by leveraging cross-dataset integration.

CMRCET B.Tech (AIML) Page 10


Pain Recognition with physiological signals using Multi-Level Context Information

CMRCET B.Tech (AIML) Page 11


Pain Recognition with physiological signals using Multi-Level Context Information

2.3.3 Implementation of Existing Method ( The affect move 2021 challenge-Affect


recognition from naturalistic movement data )

Three Main Tasks:


 EmoPain Dataset: Focused on chronic pain physical rehabilitation contexts.
 we Draw-l Movement Dataset: Applied in mathematical problem-solving settings.
 Unite-Maastricht Dance Dataset: Contexts related to dance and affective movement.

Multimodal Analysis: Participants were encouraged to incorporate data across multiple


sensor types and datasets to optimize performance.

Cross-Dataset Performance Testing: The challenge required teams to generalize their


models across varied real-life application scenarios.

Experimental Competitions: Teams competed to solve at least one of the three challenges
with methods focusing on automatic emotion detection from bodily movement data.

2.4 Methods for person-centered continuous pain intensity assessment


from biophysiological channels.

2.4.1 Introduction
The study introduces methods for developing a personalized system to continuously assess
pain intensity using biophysiological channels. The focus is on estimating individual
differences and retrieving the most relevant data using meta-information, personality traits,
and machine learning techniques.

The goal is to create specialized classifiers that are efficient, accurate, and require shorter
training times compared to classifiers trained on complete data. This study also explores the
real-time application of these systems while addressing the challenges of incremental data
processing.

CMRCET B.Tech (AIML) Page 12


Pain Recognition with physiological signals using Multi-Level Context Information

2.4.2 Merits, Demerits, and


Challenges Merits:
 Personalization: The system customizes pain intensity estimation by using individual-
specific data, improving accuracy and relevance.
 Efficiency: Specialized classifiers reduce complexity and training time compared to
traditional methods trained on all available data.
 Real-time Operation: The system can process data in real-time, which is vital for
continuous monitoring.
 Broad Feature Extraction: The system uses a variety of feature extraction algorithms
to gather comprehensive information from biophysiological signals.
 Machine Learning Techniques: Incorporation of meta-information and personality
traits optimizes the prediction model and enhances accuracy.
Demerits:
 The study's methods depend on the availability and quality of meta-information and
personality trait data.
 Real-time and incremental data processing introduces complexity and potential
technical limitations.
Challenges:
 Personalization Complexity: Creating personalized classifiers for individual
differences requires careful handling of meta-information and personality traits.
 Real-time Data Processing: Developing a system capable of continuous, real-time
pain intensity assessment introduces technical challenges, especially with incremental
data processing.

2.4.3 Implementation Method for Person-Centered Continuous Pain Intensity Assessment

1. Data Collection and Preparation


 Biophysiological Signals:
Collect physiological signals such as heart rate, skin conductivity, and facial
expressions using wearable sensors.
 Meta-Information and Personality Traits:
Gather additional contextual information such as age, gender, medical history, and
personality traits through questionnaires or surveys.
 Preprocessing:
o Clean the collected data to remove noise and outliers.
o Normalize signals for consistent scaling.

CMRCET B.Tech (AIML) Page 13


Pain Recognition with physiological signals using Multi-Level Context Information

2. Feature Extraction
 Extract features from physiological signals using algorithms like:
o Time-domain analysis (e.g., mean, standard deviation).
o Frequency-domain analysis (e.g., power spectral density).
o Nonlinear methods (e.g., entropy, fractal analysis).
 Combine extracted features with meta-information and personality traits to create a
comprehensive feature set.
3. Personalized Classifier Design
 Segmentation of Data:
o Partition data based on individual differences using meta-information and
personality traits.
 Specialized Classifiers:
o Train machine learning models (e.g., Support Vector Machines, Random
Forest, or deep learning models like CNNs) on segmented datasets.
o These classifiers adapt to specific individuals, improving personalization and
accuracy.
4. Training and Optimization
 Incremental Learning:
o Train the model with initial data and update it incrementally as new data
becomes available.
o Use methods like online learning or transfer learning for adaptation.
 Optimization Techniques:
o Use meta-information to select relevant features for each individual.
o Apply hyperparameter tuning (e.g., grid search or Bayesian optimization) to
improve model performance.
5. Real-Time Data Processing
 Implement a real-time data pipeline using technologies like:
o Edge Computing: Preprocess and analyze signals on local devices for real-
time feedback.

CMRCET B.Tech (AIML) Page 14


Pain Recognition with physiological signals using Multi-Level Context Information

o Sliding Window Techniques: Continuously update model predictions with


recent data windows.
6. Continuous Pain Intensity Assessment
 Predict pain intensity levels continuously by feeding real-time physiological signals
into the trained personalized classifier.
 Integrate predictions with visual or audio feedback systems for monitoring.
7. Validation and Testing
 Validate the model using Leave-One-Subject-Out (LOSO) Cross-Validation to
assess generalization for unseen individuals.
 Test the system's performance with real-time data streams in simulated environments
to ensure reliability and robustness.
Tools and Technologies
 Hardware: Wearable sensors, edge computing devices.
 Software: Python or R for model development, TensorFlow or PyTorch for deep
learning.
 Libraries: Sci-kit Learn for feature selection, NumPy and Pandas for preprocessing,
and Streamlit for real-time visualization.

This implementation method ensures a personalized, efficient, and real-time system for
continuous pain intensity assessment, addressing the challenges and leveraging the merits
highlighted in the study.

CMRCET B.Tech (AIML) Page 15


CMRCET B.Tech (AIML) Page 16
Pain Recognition with physiological signals using Multi-Level Context Information

Research Paper Merits demerits challenges Implementatio


n
Automatic Highlights Limited data Limited Multi-modal
recognition advancements in availability, understanding systems (e.g.,
methods non-contact and ground truth of pain face, voice,
supporting pain multimodal pain inconsistencies physiology physiology),
assessment: A recognition , and and challenges sharing and
survey systems. adaptation with improving
issues. contextual datasets, and
pain exploring
adaptation. chronic pain
areas.
The biovid heat Promises Data Use of visual
pain database objective pain Expensive, collection and and
data for the recognition time- evaluation biopotential
advancement through consuming, or challenges. signals to
and systematic biopotential/vis insufficient optimize
validation of an u al signals. evaluation automated pain
automated pain methods exist. recognition
recognition systems
system
The affect move Encourages . Ensuring Leveraging
2021 development and Generalization cross-dataset multimodal
challenge— innovation across and multi- generalization EmoPain,
Affect datasets. context & testing new Unite-
recognition from performance are real-life Maastricht
naturalistic difficult. affective Dance, and
movement data behaviors We Draw-L
Movement
datasets.

Methods for Faster training Handling differences Meta-


person-centered times, better individual & information
continuous pain accuracy differences & physiologica analysis,
intensity through physiological l data feature
assessment specialized data variability variability is extraction
from classifiers is difficult difficult. algorithms,
biophysiologica
and machine
l channels
. learning
techniques.

CMRCET B.Tech (AIML) Page 17


Pain Recognition with physiological signals using Multi-Level Context Information

CMRCET B.Tech (AIML) Page 18


Pain Recognition with physiological signals using Multi-Level Context Information

Implementation of Proposed System:-


The proposed solution leverages multilevel deep learning algorithms, specifically CNN + BI-
LSTM (bi-directional LSTM), for the task of pain recognition. These multilevel methods are
designed to optimize feature selection and improve classification performance, addressing the
limitations of traditional uni-level machine learning approaches.

Type of Algorithms Used


The solution uses multilevel deep learning algorithms (CNN + BI-LSTM) as opposed to
traditional uni-level machine learning models like SVM, Random Forest, and Linear
Regression. These traditional methods often lack the ability to perform accurate recognition
due to their limited feature handling and lower capacity to manage temporal patterns

Advantages of the Proposed Solution


1. More Secure: The multilevel approach adds robustness to the system by improving the
detection’s reliability and security.
2. High Detection and Monitoring Capabilities: CNN + BI-LSTM models excel at
multimodal feature integration and can detect subtle pain responses efficiently,
ensuring advanced monitoring.

Uni-Level ML Methods' Limitation

Uni-level machine learning algorithms like SVM, Random Forest, and Linear Regression are
unable to achieve satisfactory recognition accuracy for pain assessment. Their inability to
model temporal dependencies and integrate multiple data streams (visual, voice,
physiological) hinders their practical application. Multilevel deep learning methods, such as
CNN + BI-LSTM, provide superior performance by addressing these limitations through
advanced feature extraction and temporal data modeling.

CMRCET B Tech (AIML) Page 19


Pain Recognition with physiological signals using Multi-Level Context Information

Processing Model (SDLC - Umbrella Model):


The Software Development Life Cycle (SDLC) under the Umbrella Model has been chosen
as the systematic approach to implement the proposed solution.

SDLC Stages

1. Requirement Gathering: Goals and system features will be identified and defined.
2. Analysis: The system structure will be planned, feasibility risks will be evaluated.
3. Requirement Gathering: Goals and system features will be identified and defined.
4. Analysis: The system structure will be planned, feasibility risks will be evaluated, and
a risk management strategy will be established.

5. Designing: Relevant design diagrams, business rules, and system prototypes will be
developed.
6. Coding: The actual system development phase using the selected multilevel deep
learning architectures.
7. Testing: The developed system's accuracy and performance will be validated,
optimized, and iteratively improved.

Justification for SDLC Use


The SDLC approach ensures a structured and methodical process for the solution's
development. It supports better feature selection, efficient testing, and systematic error
mitigation at each stage. The structured model guarantees that the pain recognition system
evolves from concept to implementation in a controlled and traceable manner.

Key SDLC Outputs


The systematic implementation of SDLC will generate key deliverables such as:
 Requirements Document: Complete descriptions of the features and system goals.

CMRCET B. Tech (AIML) Page 20


Pain Recognition with physiological signals using Multi-Level Context Information

 Requirements Traceability Matrix (RTM): Links system features to goals to ensure


traceability.
 Configuration Management Plan: Details on system configuration during
implementation.
 Quality Assurance Plan: A blueprint for testing system performance.
 Updated Project Plan: Adjusted plans for each SDLC stage as the system evolves.

Key Features Being Optimized


The system focuses on optimizing feature selection and classification performance using
CNN + BI-LSTM multilevel deep learning models. This is essential to address physiological
signal inconsistencies and variability, thereby improving the system's accuracy and robustness.

Technical Workflow
1. CNN (Convolutional Neural Networks): Captures spatial features from pain-related data like
images, videos, or other visual signals.

2. BI-LSTM (Bi-directional LSTM): Handles temporal sequences and captures changes in pain
responses over time. Combining these two enables the model to integrate spatial and temporal
patterns.

Challenges Addressed

1. Generalization Issues: Traditional machine learning models fail to generalize across real-
world physiological response conditions.

2. Signal Variability: Physiological signal artifacts and emotion blending affect accuracy.

3. Inter-individual Differences: Variability among individuals' pain responses is a major


challenge.

Multilevel methods like CNN + BI-LSTM address these by improving feature extraction and
classification across time-based signals.

CMRCET B. Tech (AIML) Page 21


Pain Recognition with physiological signals using Multi-Level Context Information

Data Input Modalities


The multilevel deep learning approach integrates multimodal signals for pain recognition,
including:

•Visual Cues: Analysis of facial expressions linked to pain.

•Voice Signals: Auditory pain indicators based on speech patterns.

•Physiological Response Features: Such as biopotentials and movement data from wearable
devices

Expected Implementation Timeline with SDLC

The proposed solution will follow the systematic SDLC stages, progressing from requirement
gathering to testing and maintenance. This timeline ensures that the system is thoroughly
tested and optimized at every stage before final deployment.

CMRCET B. Tech (AIML) Page 22


Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 3
PROPOSED
SYSTEM

CMRCET B. Tech (AIML) Page 23


Pain Recognition with physiological signals using Multi-Level Context Information

3.1. Research Objective of Proposed Model:

1. Develop an Automated Pain Detection System:-


Design a deep learning-based framework that eliminates the need for manual feature selection.
Reduce dependency on subjective pain assessment methods used by healthcare professionals.

2. Enhance Feature Extraction and Classification


Implement a multi-level feature optimization approach using CNN, Bi-LSTM, and Bi-GRU.
Improve accuracy in distinguishing different pain levels through deep learning techniques.

3. Utilize Physiological Signals for Pain Recognition


Leverage Electrodermal Activity (EDA) and Electrocardiogram (ECG) signals for pain
classification.Analyze involuntary physiological responses such as heart rate fluctuations and
muscle tension.

4.Improve Accuracy and Efficiency in Pain Classification


Compare the performance of the proposed model with traditional machine learning methods
(SVM, Random Forest).Optimize the model’s architecture to achieve higher accuracy and lower false

detection rates.

5.Reduce Dependency on Handcrafted Feature Selection


Develop an automatic feature extraction method to replace labor-intensive manual feature
engineering.Utilize attention-based multi-level context modeling for enhanced classification
performance.

6.Validate the Model Using Standard Datasets


Evaluate the effectiveness of the model using the BioVid Heat Pain Dataset and EmoPain 2021
dataset.Conduct Leave-One-Subject-Out cross-validation (LOSO) to ensure model generalizability.

7. Assess Real-World Applicability in Healthcare


Investigate how the proposed model can be integrated into clinical environments for objective
pain assessment. Explore potential applications for infants, unconscious patients, and non-verbal

individuals.

8.Address Limitations in Existing Pain Detection Models


Mitigate issues related to noise and artifacts in physiological signals.
Develop a scalable model that can be deployed in real-time healthcare systems.

CMRCET B. Tech (AIML) Page 24


Pain Recognition with physiological signals using Multi-Level Context Information

3.2 ALGORIHTMS USED FOR PROPOSED MODEL:-

RandomForest: A powerful ensemble learning method that builds multiple decision trees during
training and aggregates their predictions for classification (mode) or regression
(average). It is widely used for various domains such as finance, healthcare, and image
analysis, offering robustness and high accuracy.

CNN+BiLSTM: This hybrid model integrates Convolutional Neural Networks (CNN) with Bidirectional

Long Short-Term Memory (Bi-LSTM) networks, making it highly effective for


sequential data tasks. CNNs extract spatial features, while BiLSTM efficiently captures

temporal dependencies, making it ideal for natural language processing (NLP) and time

series forecasting.

CNN+BiLSTM+BiGRU: An advanced deep learning architecture that combines CNN, BiLSTM, and

Bidirectional Gated Recurrent Unit (BiGRU) networks. This model excels at


hierarchical feature extraction and temporal pattern recognition, making it
suitable for complex applications like video processing and sentiment analysis

3.3 DESIGNING

DESIGNING: The design stage takes as its initial input the requirements identified in the approved
requirements document. For each requirement, a set of one or more design elements will
be produced as a result of interviews, workshops, and/or prototype efforts. Design
elements describe the desired software features in detail, and generally include
functional hierarchy diagrams, screen layout diagrams, tables of business rules, business
process diagrams, pseudo code, and a complete entity-relationship diagram with a full
data dictionary. These design elements are intended to describe the software in sufficient

detail that skilled programmers may develop the software with minimal additional input.
When the design document is finalized and accepted, the RTM is updated to show that

each design element is formally associated with a specific requirement. The outputs of
CMRCET B. Tech (AIML) Page 25
Pain Recognition with physiological signals using Multi-Level Context Information
the design stage are the design document, an updated RTM, and an updated project plan.

CMRCET B. Tech (AIML) Page 26


Pain Recognition with physiological signals using Multi-Level Context Information

3.3.1 UML Diagram

UML Diagram: The Unified Modelling Language allows the software engineer to express an analysis model
using the modelling notation that is governed by a set of syntactic semantic and pragmatic
rules

Class Diagram: A class diagram is a key part of object-oriented modeling. It shows the structure of a
system and relationships between objects. Each class is represented as a box with three
parts:
1.Name – Class identifier
2.Attributes – Properties of the class
3. Methods – Functions of the class
Class diagrams help in designing, coding, and organizing software efficiently.

PainRecognition.py
x,y
X_train, X_test
y_train, y_test

uploadDataset()
preprocessDataset()
def CalculateMetrices()
def RandomForest()

Use case Diagram: A use case diagram shows how users interact with a system. It highlights different types
of users and their actions. This diagram is often used with textual use cases and other
diagrams to explain system behavior.

uploadDataset()

preprocessDataset()

User def CalculateMetrices()

def RandomForest()

CMRCET B. Tech (AIML) Page 27


Pain Recognition with physiological signals using Multi-Level Context Information
Sequence diagram: A sequence diagram shows how objects interact in a specific order. It illustrates message
flow between objects over time to complete a task. Often used with use cases, it helps
visualize system processes. Also known as an event diagram or timing diagram.

Collaboration diagram: A collaboration diagram shows how objects interact using sequenced messages. It
combines details from class, sequence, and use case diagrams to represent both
structure and behavior of a system.

CMRCET B. Tech (AIML) Page 28


Pain Recognition with physiological signals using Multi-Level Context Information

Component Diagram: A component diagram in UML shows how different parts of a system connect and
work together. It illustrates the structure of complex systems by linking components
through assembly connectors, representing the service consumer-provider
relationship.

Deployment Diagram: A deployment diagram in UML shows how software and hardware components
work together. It represents nodes (e.g., servers) and artifacts (e.g., applications) and
how they connect. Nodes are shown as boxes, with artifacts inside them, and can
have sub-nodes for complex systems.

CMRCET B. Tech (AIML) Page 29


Pain Recognition with physiological signals using Multi-Level Context Information
Activity Diagram: An activity diagram in UML shows the flow of activities in a system, like a flowchart. It
represents operations and their sequence, which can be sequential, branched,
concurrent.

Upload Dataset

Preprocess Dataset

Calculate Metrices
datasetSplit
datasetSplit

Run Random Forest

Predict

Data Flow Diagram:A Data Flow Diagram (DFD) shows how data moves through a system, illustrating inputs,
CMRCET B. Tech (AIML) Page 30
Pain Recognition with physiological signals using Multi-Level Context Information
processes, and outputs. It provides a clear view of business functions and can be detailed as
needed. DFDs use simple symbols to represent data flow and help in analyzing and
automating processes.

User

1. upload dataset 2.upload dataset successfully

3. preprocess dataset 4.preprocess dataset successfully


5. Calulate Metrices 6. Calculate Metrices Successfully\

7. Run Random Forest Algorithm 8. Random Forest Algorithm Successfully

SYSTEM

Fig.Flow of data Diagram

CMRCET B. Tech (AIML) Page 31


Pain Recognition with physiological signals using Multi-Level Context Information

FIGURE: OVERVIEW OF PROPOSED MODEL

CMRCET B. Tech (AIML) Page 32


Pain Recognition with physiological signals using Multi-Level Context Information

3.4.Stepwise Implementation and Code:

IMPLEMENTATION:

Data Exploration: This module is responsible for loading and analyzing data within the system.
Examining the BioVid_coords dataset to understand its structure and
contents. Processing data using Pandas and NumPy for reshaping and
eliminating unnecessary columns. Normalizing the training dataset using an
appropriate scaling technique to ensure consistency. Visualizing data patterns
with Seaborn and Matplotlib to gain insights. Applying label encoding to
transform categorical attributes into numerical representations. Selecting key
features to enhance model accuracy and efficiency.

Data Splitting: Part Breaking the dataset into train and test segments to evaluate model performance.

Model Development: Building multiple models, including Random Forest,


CNN + BiLSTM, CNN + BiLSTM + BiGRU, andStackingClassifier

User Authentication: Implementing user registration and login functionality

User Input: Allowingusersto input datafor prediction. Prediction Module:

Generating and displaying the final predicted results.

Note: As an enhancement, we implemented an ensemble learning approach, combining multiple models to


achieve a more reliable and accurate prediction. Additionally, by utilizing techniques such as CNN +
BiLSTM + BiGRU and Stacking Classifier, we achieved an accuracy of 99%.

CODE:
from tkinter import *
from tkinter import simpledialog
import tkinter
from tkinter import filedialog
import seaborn as sns
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import pickle

import numpy as np
import pandas as pd
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_spl

CMRCET B. Tech (AIML) Page 33


Pain Recognition with physiological signals using Multi-Level Context Information

from keras.models import Sequential, load_model


from keras.layers import Dense, TimeDistributed, Conv1D, MaxPooling1D, Flatten, Activation, RepeatVector
from keras.layers import LSTM #class for LSTM training
import os
from keras.layers import Dropout
from keras.callbacks import ModelCheckpoint
from keras.layers import Bidirectional, GRU #class for bidirectional LSTM as BILSTM and GRU
from keras.utils.np_utils import to_categorical

from sklearn.metrics import accuracy_score


import pickle
from sklearn import svm
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import LeaveOneOut #class to calculate LOSO
from sklearn.model_selection import cross_val_score

main = tkinter.Tk()
main.title("Pain Recognition") #designing main screen
main.geometry("1300x1200")

global filename, dataset, X_train, X_test, y_train, y_test, X, Y, scaler, pca


global accuracy, precision, recall, fscore, values,algorithm, predict,unique,extension_model
precision = []
recall = []
fscore = []
accuracy = []
loso = []

def uploadDataset():
global filename, dataset, labels, values,unique
filename = filedialog.askopenfilename(initialdir = "Dataset")
text.delete('1.0', END)
text.insert(END,'Dataset loaded\n\n')
dataset = pd.read_csv(filename)
dataset.fillna(0, inplace = True)
text.insert(END,str(dataset))
data = dataset.values
plt.plot(data)
plt.xlabel("Number of Records")
plt.ylabel("Signals")
plt.title("EEG Signal from all Subjects")
plt.show()

def processDataset():
global dataset, X, Y
global X_train, X_test, y_train, y_test, pca, scaler,labels
text.delete('1.0', END)
dataset = dataset.values

CMRCET B. Tech (AIML) Page 34


Pain Recognition with physiological signals using Multi-Level Context Information

X = dataset[:,0:dataset.shape[1]-1] #extract training features as X


Y = dataset[:,dataset.shape[1]-1] #extract target pain label
scaler = MinMaxScaler((0,1))
X = scaler.fit_transform(X)#normalized features
indices = np.arange(X.shape[0])
np.random.shuffle(indices) #shuffle the dataset values
X = X[indices]
Y = Y[indices]
text.insert(END,"Normalized Training Features : \n\n "+str(X)+"\n")
X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.2) #split dataset into train and test
print()
text.insert(END,"Dataset train & test split as 80% dataset for training and 20% for testing"+"\n")
text.insert(END,"Training Size (80%): "+str(X_train.shape[0])+"\n") #print training and test size
text.insert(END,"Testing Size (20%): "+str(X_test.shape[0])+"\n")
print()
labels, count = np.unique(dataset[:, -1], return_counts = True)
labels = ["Pain0", "Pain1", "Pain2" ,"Pain3", "Pain4"]
height = count
bars = labels
y_pos = np.arange(len(bars))
plt.bar(y_pos, height)
plt.xticks(y_pos, bars)
plt.xlabel("Dataset Class Label Graph")
plt.ylabel("Count")
plt.show()
def calculateMetrics(algorithm, predict, testY,labels):
p = precision_score(testY, predict,average='macro') * 100
r = recall_score(testY, predict,average='macro') * 100
f = f1_score(testY, predict,average='macro') * 100
a = accuracy_score(testY,predict)*100
print()
text.insert(END,algorithm+' Accuracy : '+str(a)+"\n")
text.insert(END,algorithm+' Precision : '+str(p)+"\n")
text.insert(END,algorithm+' Recall : '+str(r)+"\n")
text.insert(END,algorithm+' FMeasure : '+str(f)+"\n")
accuracy.append(a)
precision.append(p)
recall.append(r)
fscore.append(f)
conf_matrix = confusion_matrix(testY, predict)
plt.figure(figsize =(5, 5))
ax = sns.heatmap(conf_matrix, xticklabels = labels, yticklabels = labels, annot = True, cmap="viridis" ,fmt
="g");
ax.set_ylim([0,len(labels)])
plt.title(algorithm+" Confusion matrix")
plt.ylabel('True class')
plt.xlabel('Predicted class')
plt.show(

CMRCET B. Tech (AIML) Page 35


Pain Recognition with physiological signals using Multi-Level Context Information

def trainRF():
global X_train, y_train, X_test, y_test
global algorithm, predict, test_labels,labels
text.delete('1.0', END)
rf = RandomForestClassifier(n_estimators=40, criterion='gini', max_features="log2",
min_weight_fraction_leaf=0.3)
rf.fit(X_train, y_train)
predict = rf.predict(X_test)#perform prediction on test data
calculateMetrics("Existing Random Forest", predict, y_test,labels)#call function to calculate accuracy and other
metrics
def trainCNNBILSTM():
global X_train, y_train, X_test, y_test
global algorithm, predict,labels
text.delete('1.0', END)
X_train = np.reshape(X_train, (X_train.shape[0], 34, 4))
X_test = np.reshape(X_test, (X_test.shape[0], 34, 4))
y_train = to_categorical(y_train)
y_test = to_categorical(y_test)
#create CNN sequential object
propose_model = Sequential()
#create CNN1D layer with 32 neurons for data filteration and pool size as 3
propose_model.add(Conv1D(filters=32, kernel_size = 3, activation = 'relu', input_shape = (X_train.shape[1], X_train.shape[2])))
#defining another CNN layer with 64 neurons
propose_model.add(Conv1D(filters=64, kernel_size = 2, activation = 'relu'))
propose_model.add(Conv1D(filters=128, kernel_size = 2, activation = 'relu'))
#max pooling layer to collect relevant features from CNN layer
propose_model.add(MaxPooling1D(pool_size = 1))
propose_model.add(Flatten())
propose_model.add(RepeatVector(2))
#defining BILSTM kayer with 32 neurons to optimize CNN features
propose_model.add(Bidirectional(LSTM(32, activation = 'relu', return_sequences=True)))
propose_model.add(Bidirectional(LSTM(64, activation = 'relu')))
#adding dropout layer to remove irrelevant features
propose_model.add(Dropout(0.2))
#defining output an dprediction layer
propose_model.add(Dense(units = 100, activation = 'softmax'))
propose_model.add(Dense(units = y_train.shape[1], activation = 'softmax'))
#train and compile the model
propose_model.compile(optimizer = 'adam', loss = 'categorical_crossentropy', metrics = ['accuracy'])
if os.path.exists("model/propose_weights.hdf5") == False:
model_check_point = ModelCheckpoint(filepath='model/propose_weights.hdf5', verbose = 1, save_best_only = True)
hist = propose_model.fit(X_train, y_train, batch_size = 32, epochs = 10, validation_data=(X_test, y_test),
callbacks=[model_check_point], verbose=1)
f = open('model/propose_history.pckl', 'wb')
pickle.dump(hist.history, f)
f.close()
else:
propose_model = load_model("model/propose_weights.hdf5")
#perform prediction on test data
CMRCET B. Tech (AIML) Page 36
Pain Recognition with physiological signals using Multi-Level Context Information
predict = propose_model.predict(X_test)
predict = np.argmax(predict, axis=1)

y_test1 = np.argmax(y_test, axis=1)


calculateMetrics("Propose CNN + BILSTM", predict, y_test1, labels)#call function to calculate accuracy and other metrics
def trainCNNBILSTMBIGRU():
global X_train, y_train, X_test, y_test
global algorithm, predict,labels,extension_model
text.delete('1.0', END)
extension_model = Sequential()
#create CNN1D layer with 32 neurons for data filteration and pool size as 3
extension_model.add(Conv1D(filters=32, kernel_size = 3, activation = 'relu', input_shape = (X_train.shape[1], X_train.shape[2])))
extension_model.add(Conv1D(filters=64, kernel_size = 2, activation = 'relu'))
extension_model.add(Conv1D(filters=128, kernel_size = 2, activation = 'relu'))
extension_model.add(MaxPooling1D(pool_size = 1))
extension_model.add(Flatten())
extension_model.add(RepeatVector(2))
#adding LSTM Bidirectional layer to obtained optimized features from CNN
extension_model.add(Bidirectional(LSTM(32, activation = 'relu', return_sequences=True)))
#now bidirectional GRU will extract optimized fetaures from BI-LSTM and then train a model with below prediction layer
extension_model.add(Bidirectional(GRU(64, activation = 'relu')))
extension_model.add(Dropout(0.2))
#Define output prediction layer
extension_model.add(Dense(units = 100, activation = 'softmax'))
extension_model.add(Dense(units = y_train.shape[1], activation = 'softmax'))
#compile and train the model
extension_model.compile(optimizer = 'adam', loss = 'categorical_crossentropy', metrics = ['accuracy'])
if os.path.exists("model/extension_weights.hdf5") == False:
model_check_point = ModelCheckpoint(filepath='model/extension_weights.hdf5', verbose = 1, save_best_only = True)
hist = extension_model.fit(X_train, y_train, batch_size = 32, epochs = 10, validation_data=(X_test, y_test),
callbacks=[model_check_point], verbose=1)
f = open('model/extension_history.pckl', 'wb')
pickle.dump(hist.history, f)
f.close()
else:
extension_model = load_model("model/extension_weights.hdf5")
#perform prediction on test data
predict = extension_model.predict(X_test)
predict = np.argmax(predict, axis=1)
y_test1 = np.argmax(y_test, axis=1)
calculateMetrics("Etension CNN + BILSTM + BIGRU", predict, y_test1, labels)#call function to calculate accuracy and other
metrics
def graph():
global X_train, y_train, X_test, y_test
global algorithm, predict,labels
text.delete('1.0', END)
df = pd.DataFrame([['Existing Random Forest','Precision',precision[0]],['Existing Random Forest','Recall',recall[0]],['Existing
Random Forest','F1 Score',fscore[0]],['Existing Random Forest','Accuracy',accuracy[0]],
['Propsoe CNN + BI-LSTM','Precision',precision[1]],['Propsoe CNN + BI-LSTM','Recall',recall[1]],['Propsoe CNN +
CMRCET B. Tech (AIML) Page 37
Pain Recognition with physiological signals using Multi-Level Context Information
BI-LSTM','F1 Score',fscore[1]],['Propsoe CNN + BI-LSTM','Accuracy',accuracy[1]],
['Extension CNN + BI-LSTM + BI-GRU','Precision',precision[2]],['Extension CNN + BI-LSTM + BI-
GRU','Recall',recall[2]],['Extension CNN + BI-LSTM + BI-GRU','F1 Score',fscore[2]],['Extension CNN + BI-LSTM + BI-
GRU','Accuracy',accuracy[2]],
],columns=['Parameters','Algorithms','Value'])
df.pivot("Parameters", "Algorithms", "Value").plot(kind='bar')
plt.title("All Algorithms Performance Graph")
plt.show()

def predict():
global X_train, y_train, X_test, y_test
global algorithm, predict,labels,extension_model
text.delete('1.0', END)
testData = pd.read_csv("Dataset/testData.csv")#reading test data
testData.fillna(0, inplace = True)
temp = testData.values
testData = testData.values
test = scaler.transform(testData)#normalizing values
test = np.reshape(test, (test.shape[0], 34, 4))
predict = extension_model.predict(test)#performing prediction on test data using extension model object
for i in range(len(predict)):
y_pred = np.argmax(predict[i])
text.insert(END,"Test Data = "+str(temp[i])+" Predicted Pain Type ====> "+labels[y_pred]+"\n")

font = ('times', 16, 'bold')


title = Label(main, text='Pain Recognition With Physiological Signals Using Multi-Level Context Information')
title.config(bg='gray24', fg='white')
title.config(font=font)
title.config(height=3, width=120)
title.place(x=0,y=5)

CMRCET B. Tech (AIML) Page 38


Pain Recognition with physiological signals using Multi-Level Context Information

CMRCET B. Tech (AIML) Page 39


Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 4
RESULTS AND
DISCUSSION

CMRCET B. Tech (AIML) Page 40


Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 4
RESULTS AND DISCUSSION
4.1 Comparision of existing solutions:
Method/Technique Description Strengths
Weaknesses Performance
Support Vector A traditional classifies - Relies on Moderate
Machines (SVM) machine signalsbased manually accuracy;
learning model on extracted extracted varies
that classifies features. features. depending on
signals based - Poor feature
- Effective for
on extracted performance with extraction.
linear
features. noisy signals
separation.
- Well-
established in
feature-based
analysis.
Random Forest Ensemble - Robust to overfitting. Moderate
method that overfitting. - Handles accuracy with
uses decision - Handles nonlinearities varying
trees for nonlinearities well. subject
classification well. responses.
- Still dependent
based on hand-
on manual
crafted features.
feature
extraction.
-
Computationally
intensive.

CMRCET B. Tech (AIML) Page 41


Pain Recognition with physiological signals using Multi-Level Context Information

Linear A simple Fast - Limited to Low accuracy


Regression (LR) statistical computation. linear compared to
method applied - Simple to mappings. advanced
to map features implement. - Does methods
to pain states. not
capture
temporal
dependencies
Handcrafted - Incorporates - Time- Results vary
Features are
expert consuming. depending on
extracted using
knowledge. - Requires quality and
expert domain
- Allows domain selection of
knowledge
targeted feature expertise. features.
from
extraction. - Less
physiological
adaptable to
signals.
new signals.
Convolutional A deep - Efficient - Limited in Good results for
Neural Networkslearning model feature capturing spatial patterns
(CNN) optimized for extraction. temporal but insufficient
spatial features - Robust dependencies for temporal
extraction from to noise alone. sequences.
signal data.
Bi-LSTM Combines - Captures - High
(Bidirectional temporal temporal Computationally performance for
LSTM) dependencies context expensive. sequence-based
forward and effectively. - Requires pain detection.
backward to - Useful large training
model signal for datasets.
sequence sequential
information. analysis.
CNN + Bi-LSTM Hybrid - Combines - Requires more Achieved 84.8%
(Multi-Level model spatial and computational to 87.8% in
Context) combining CNN temporal resources. accuracy
(for spatial analysis. - Complex depending on
features) with - Eliminates architecture to subject dataset
Bi-LSTM (for dependency on implement and sizes using
temporal manually train. LOSO cross-
sequence crafted features validation.
modeling)

CMRCET B. Tech (AIML) Page 42


Pain Recognition with physiological signals using Multi-Level Context Information

Results and Discussion


Key Findings
1. Machine Learning Results:
o SVM & Random Forest:
 Accuracy was between 65% to 75%.
 These methods depend on manually extracted features, which limits
their performance.
2. CNN (Convolutional Neural Networks):
o Accuracy ranged from 75% to 80%.
o CNNs are good at capturing patterns in the spatial data from signals.
3. Bi-LSTM (Bidirectional LSTM):
o Accuracy was 78% to 82%.
o Bi-LSTM works well with time sequences and models signal patterns over time.
4. CNN + Bi-LSTM (Hybrid Model):
o Achieved the best results, 84.8% to 87.8% accuracy.
o This approach combines the strengths of CNN (spatial patterns) and Bi-LSTM
(time patterns)

Discussion

1. Why CNN + Bi-LSTM Works Best:


o Combines CNN (to learn spatial features) and Bi-LSTM (to learn time patterns)
effectively.
o This leads to the most accurate and reliable results.
2. Traditional Methods Are Limited:
o Models like SVM or Random Forest rely on manual data features, making them
less effective.
3. Deep Learning Strengths:
o CNNs and Bi-LSTMs automatically learn patterns from raw signal data without
manual feature engineering.

CMRCET B. Tech (AIML) Page 43


Pain Recognition with physiological signals using Multi-Level Context Information

4. Testing with LOSO Cross-Validation:


o Tested the model by leaving one subject out at a time, proving that CNN + Bi-
LSTM can generalize well across individuals.

4.2. Data Collection and Performance Metrics

Data Collection
Source of Data:
The data was collected from publicly available datasets containing physiological signals such
as heart rate, skin conductivity, and facial expressions. These signals were captured under
varying pain conditions.

Subjects: Multiple individuals participated, providing diverse samples to enhance model


generalizability.

Preprocessing: The raw signals were cleaned and normalized to remove noise and inconsistencies
before being used for training and testing.

Performance Metrics
To evaluate the effectiveness of the models, the following metrics were used:

Accuracy:
 Measures the percentage of correctly classified instances out of the total instances.
 The CNN + Bi-LSTM hybrid model achieved the highest accuracy (84.8% to 87.8%).

Sensitivity (Recall):
 Indicates the ability of the model to correctly identify true positives
(pain conditions).
 The hybrid model showed sensitivity ranging from 81% to 86%,
demonstrating its effectiveness in identifying pain signals.

CMRCET B. Tech(AIML) Page 44


Pain Recognition with physiological signals using Multi-Level Context Information

 Specificity:
 Measures the ability to correctly identify true negatives (no-pain
conditions).
 The hybrid model recorded specificity values between 85% and 88%,
showing it is reliable in excluding false positives.
 Validation Method:
 LOSO Cross-Validation (Leave-One-Subject-Out) was employed to
assess the models.
 This approach tests the model’s ability to generalize by training on all
but one subject and testing on the excluded subject.
 Key Observations from Metrics:
 Traditional Models (SVM, Random Forest):
 Achieved moderate performance with 65% to 75% accuracy, limited
by dependence on manually extracted features.
 Deep Learning Models (CNN, Bi-LSTM):
 Showed significant improvement with accuracies of 75% to 82%,
leveraging automatic feature extraction.
 Best Performer:
 The CNN + Bi-LSTM hybrid model excelled in all metrics,
showcasing its ability to combine spatial and temporal feature learning
for superior results.
 These metrics underscore the importance of hybrid architectures and
robust validation in developing effective solutions for pain detection.

CMRCET B. Tech(AIML) Page 45


Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 5
CONCLUSION

CMRCET B. Tech (AIML) Page 46


Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 5
CONCLUSION

The study demonstrates that the CNN + Bi-LSTM hybrid model is the most robust and
effective solution for real-time pain detection from physiological signals. This approach
leverages multi-level spatial and temporal feature extraction to outperform traditional
machine learning models and standalone deep learning methods.
The findings highlight the importance of combining CNNs and Bi-LSTMs in pain
detection tasks to provide both spatial and temporal context, resulting in higher accuracy
and better generalization. Future improvements could focus on model optimization to
ensure real- time implementation on edge devices.

CMRCET B. Tech (AIML) Page 47


Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 6
REFERENCES

CMRCET B. Tech (AIML) Page 48


Pain Recognition with physiological signals using Multi-Level Context Information

CHAPTER 6
REFERENCES

1. https://www.researchgate.net/publication/336447252_Automatic_Recognition_Methods_
Supporting_Pain_Asse ssment_A_Survey

2. https://ieeexplore.ieee.org/document/9666322

3. https://www.researchgate.net/publication/319316942_Analysis_of_Facial_Expressiveness
_During_Experimenta lly_Induced_Heat_Pain

4. https://www.researchgate.net/publication/319316942_Analysis_of_Facial_Expressiveness
_During_Experimenta lly_Induced_Heat_Pain

CMRCET B. Tech(AIML) Page 49

You might also like