SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Copyright © SAS Institute Inc. All rights reserved.
Human Activity Recognition in Python:
Signal Analysis & Feature Extraction Methods
Utilizing Fourier and Wavelet Transformations
Compiled & Presented by William Nadolski
Based upon Jupyter Notebook created by Ahmet Taspinar
Copyright © SAS Institute Inc. All rights reserved.
Presentation Agenda
• Human Activity Recognition Dataset
- Introduction to the data and classification task
- Performance of traditional feature extraction approaches for signal analysis
• Fourier Analysis
- Brief introduction to the Fast Fourier Transform (FFT)
- Feature extraction using the FFT
- Disadvantages of the FFT
• Wavelet Analysis
- Introduction to Wavelets
- Spectrogram creation using the Continuous Wavelet Transform (CWT)
• Train a deep learning convolutional neural network model (DLCNN)
on CWT-derived Spectrogram Images Using Keras Python API
• Potential Applications
Copyright © SAS Institute Inc. All rights reserved.
Human Activity Recognition (HAR) Dataset
Download Data
• Consists of tri-axial accelerometer, gyroscope, and total acceleration data
collected via waist-worn smartphone while performing six different activities
• Data is sampled at 50 Hz and segmented into 10,299 distinct windows of
128 samples (2.56 sec each) and pre-split 70/30 into train/test subsets
• Data has been pre-processed and standardized to remove noise
• Goal is to classify activity using only the nine signal components
Data Citation: Davide Anguita, Alessandro Ghio, Luca Oneto, Xavier Parra and Jorge L. Reyes-Ortiz. A Public Domain Dataset for Human Activity RecognitionUsing Smartphones.
21th European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning, ESANN 2013. Bruges, Belgium 24-26 April 2013
Image Citation: http://ataspinar.com/wp-content/uploads/2018/01/3d_plot.png
9 Signal Components
128
Samples
Copyright © SAS Institute Inc. All rights reserved.
Traditional ML Approach
Model Training Using Python sklearn
1. Load and plot the data
2. Extract summary statistics for each signal component within each record
- Min | Max | Mean | Median | Std Dev | Skew | Kurt
3. Iteratively model using different classifiers
Copyright © SAS Institute Inc. All rights reserved.
Introduction to Fourier Transform
What is it and how can it be leveraged for machine learning?
The Fourier Transform decomposes a stationary time series signal into its
constituent frequencies. Allows us to convert the signal from the time domain
to the frequency domain and extract potentially useful features.
Fast Fourier Transform (FFT) is synonymous w/ Discrete Fourier Transform (DFT)
Fourier Equation: https://betterexplained.com/wp-content/uploads/images/DerivedDFT.png
Fourier Visual: https://www.nti-audio.com/portals/0/pic/news/FFT-Time-Frequency-View-540.png
Copyright © SAS Institute Inc. All rights reserved.
Fast Fourier Transform in Python
Simulating and Decomposing a Composite Signal
• Create a composite signal from five constituent sine waves
• Decompose into Fourier magnitude and Power Spectral Density (PSD)
Copyright © SAS Institute Inc. All rights reserved.
Feature Extraction Using FFT in Python
Return to HAR Dataset
• Example of applying the FFT to each signal component
• Interested in identifying the local maxima of the FFT & PSD functions
• Specifically interested in extracting the (f, a) coordinates for each peak
Copyright © SAS Institute Inc. All rights reserved.
Feature Extraction Using FFT in Python
Returning to HAR Dataset
• No longer using traditional descriptive statistics
• Instead identify local maxima based on FFT of the signal component
• Wish to extract both the frequency and amplitude for top N peaks
• One set for FFT coefficient peaks and another set based on PSD values
• Using only top 3 peaks, we should expect the following features per record:
• 9 components X top 3 peaks X 4 coordinates (f,p for FFT and f,p for PSD) = 108 features
• If no peak present, impute zero value
108 features
Image: http://ataspinar.com/wp-content/uploads/2018/01/signal_to_matrix2.png
f = frequency
P = power (amplitude)
Copyright © SAS Institute Inc. All rights reserved.
Feature Extraction Using FFT in Python
Returning to HAR Dataset
• Again, iterate over 10 different classifiers using scikit-learn
FFT provides a 3.4% point
boost in accuracy compared
to basic summary stats approach!
Copyright © SAS Institute Inc. All rights reserved.
El Niño Data
Limitations of the Fast Fourier Transform
• Example: El Niño quarterly sea surface temperature from 1870-1996
Copyright © SAS Institute Inc. All rights reserved.
El Niño Data
Limitations of the Fast Fourier Transform
Suggests a seasonality of
2-8 years (0.125 – 0.50 Hz)
Wikipedia: El Niño phases are known to occur close to four years, however,
records demonstrate that the cycles have lasted between two and seven years.
• Example: El Niño quarterly sea surface temperature from 1870-1996
Copyright © SAS Institute Inc. All rights reserved.
Introduction to Wavelets
What are they and how can it be leveraged for machine learning?
• Wavelets: Localized in time with finite energy and zero mean
• Instead of frequency, uses frequency bands referred to as scales
• Wavelet Transform involves convolving a time series signal with a
“mother” wavelet at different scales (frequencies)
Sine vs. Wavelet: http://ataspinar.com/wp-content/uploads/2018/07/Wavelet-Out1.jpg
Wavelet Transform GIF: http://ataspinar.com/wp-content/uploads/2018/12/wavelet_convolution_3d_2d_final.gif
Image: http://ataspinar.com/wp-content/uploads/2018/08/Comparisonoftransformations.jpg
Copyright © SAS Institute Inc. All rights reserved.
El Niño Data
Continuous Wavelet Transform (CWT)
• Wavelet transform is used in many digital signal processing tasks
such as audio filtering, data compression, image analysis, etc.
• Allows us to generate a 2D image of the signal called a spectrogram
• Generate spectrogram from El Niño data
Copyright © SAS Institute Inc. All rights reserved.
Continuous Wavelet Transform
CWT Spectrogram of El Nino Data
• Shows power of a signal across different frequencies at different points in time
• Allows us to visualize changes over time within the frequency domain
• Shaded area corresponds to cone of influence
Copyright © SAS Institute Inc. All rights reserved.
Continuous Wavelet Transform
Returning to HAR Dataset
• Going to train a CNN on each set of 9 spectrogram images via Keras in Python
• Extract 128x128 pixel spectrogram of each signal component for each record
• RGB images have 3 channels, we’ll just treat each signal component as its own channel
Copyright © SAS Institute Inc. All rights reserved.
Convolutional Neural Network for HAR Classification
Utilizing Keras API within Python
• Modified LeNet architecture utilized:
- 1. Produce 32 feature maps using a 5x5 kernel with ReLu activation
- 2. Apply max pooling of size 2x2 with a 2x2 stride
- 3. Apply a dropout layer with probability 2.5%
- 4. Produce 64 feature maps using a 5x5 kernel with ReLu activation
- 5. Apply max pooling of size 2x2
- 6. Apply a dropout layer with probability 2.5%
- 7. Flatten the feature maps for each recording
- 8. Pass through a fully connected layer of 1,000 nodes
- 9. Apply dropout layer with probability 50%
- 10. Apply a softmax activation function to predict class label
CNN Architecture: http://ataspinar.com/wp-content/uploads/2018/12/9layer_image_CNN.png
def train_CNN(batch_size=64, epochs=100, lr=0.0001):
model = Sequential()
model.add(Conv2D(32, kernel_size=(5, 5),
strides=(1, 1), activation='relu’, input_shape=(127,127,9)))
model.add(MaxPooling2D(pool_size=(2, 2), strides=(2, 2)))
model.add(Dropout(0.025))
model.add(Conv2D(64, (5, 5), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.025))
model.add(Flatten())
model.add(Dense(1000, activation='relu'))
model.add(Dropout(0.50))
model.add(Dense(num_classes, activation='softmax'))
model.compile(loss=keras.losses.categorical_crossentropy,
optimizer=keras.optimizers.Adam(lr=lr, decay=0.0, amsgrad=False),
metrics=['accuracy'])
model.fit(Xtrain_CWT, Ytrain_CWT, batch_size=batch_size,
epochs=epochs, verbose=1,
validation_data=(Xtest_CWT, Ytest_CWT),
callbacks=[history])
Copyright © SAS Institute Inc. All rights reserved.
Convolutional Neural Network for HAR Classification
Model Performance Over Time
• Obtained a maximum test accuracy of 96.1% with an average of ~95.5%
• Achieved +6.11% point increase in classification accuracy using CWT over FFT!
Epoch 71/100: 5000/5000 [==============================] train_loss: 0.0026 – train_acc: 0.9998 - val_loss: 0.3205 - val_acc: 0.9565
Epoch 72/100: 5000/5000 [==============================] train_loss: 0.0048 – train_acc: 0.9984 - val_loss: 0.3162 - val_acc: 0.9610
Epoch 73/100: 5000/5000 [==============================] train_loss: 0.0060 – train_acc: 0.9994 - val_loss: 0.3653 - val_acc: 0.9535
Comparison of different methods
Copyright © SAS Institute Inc. All rights reserved.
Potential Applications
• IoT signal analysis
• Wearable medical devices
• Audio processing and analysis
• Image analysis and computer vision tasks
• Defect detection based on manufacturing machine sensors
• Supplement existing time series modelling approaches
• Data compression and dimensionality reduction techniques
• Data smoothing and signal denoising
Copyright © SAS Institute Inc. All rights reserved.
Summary of Analysis
• Reviewed attributes of the HAR dataset and visualized sensor data
• Extracted traditional summary statistics for use in modeling
• Iterated over numerous classifiers to assess baseline model accuracy
• Fast Fourier Transformation
• Introduced the concept of the Fourier Transform
• Extracted FFT-derived features from the HAR dataset
• Improved model accuracy using only the FFT-derived features
• Illustrated some of the limitations and disadvantages of the FFT
• Wavelet Transformation
• Introduced the concept of the Wavelet Transformation and its benefits
• Used the CWT to create a spectrogram and visualize the El Nino dataset
• Used CWT-derived spectrograms of HAR data to train a CNN with Keras
Copyright © SAS Institute Inc. All rights reserved.
Questions?

Weitere ähnliche Inhalte

Ähnlich wie Times Series Feature Extraction Methods of Wearable Signal Data for Deep Learning Computer Vision Applications

Targeting GPUs using OpenMP Directives on Summit with GenASiS: A Simple and...
Targeting GPUs using OpenMP  Directives on Summit with  GenASiS: A Simple and...Targeting GPUs using OpenMP  Directives on Summit with  GenASiS: A Simple and...
Targeting GPUs using OpenMP Directives on Summit with GenASiS: A Simple and...Ganesan Narayanasamy
 
FORECASTING MUSIC GENRE (RNN - LSTM)
FORECASTING MUSIC GENRE (RNN - LSTM)FORECASTING MUSIC GENRE (RNN - LSTM)
FORECASTING MUSIC GENRE (RNN - LSTM)IRJET Journal
 
Iaetsd pipelined parallel fft architecture through folding transformation
Iaetsd pipelined parallel fft architecture through folding transformationIaetsd pipelined parallel fft architecture through folding transformation
Iaetsd pipelined parallel fft architecture through folding transformationIaetsd Iaetsd
 
Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...
Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...
Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...Intel® Software
 
Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...
Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...
Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...MLconf
 
The CAOS framework: democratize the acceleration of compute intensive applica...
The CAOS framework: democratize the acceleration of compute intensive applica...The CAOS framework: democratize the acceleration of compute intensive applica...
The CAOS framework: democratize the acceleration of compute intensive applica...NECST Lab @ Politecnico di Milano
 
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...NECST Lab @ Politecnico di Milano
 
2007 Tidc India Profiling
2007 Tidc India Profiling2007 Tidc India Profiling
2007 Tidc India Profilingdanrinkes
 
Zd n2010 son-in_4g_mobile_networks (1)
Zd n2010 son-in_4g_mobile_networks (1)Zd n2010 son-in_4g_mobile_networks (1)
Zd n2010 son-in_4g_mobile_networks (1)derejew
 
byteLAKE's expertise across NVIDIA architectures and configurations
byteLAKE's expertise across NVIDIA architectures and configurationsbyteLAKE's expertise across NVIDIA architectures and configurations
byteLAKE's expertise across NVIDIA architectures and configurationsbyteLAKE
 
INDUSTRIAL TRAINING REPORT
INDUSTRIAL TRAINING REPORTINDUSTRIAL TRAINING REPORT
INDUSTRIAL TRAINING REPORTABHISHEK DABRAL
 
Barcelona Supercomputing Center, Generador de Riqueza
Barcelona Supercomputing Center, Generador de RiquezaBarcelona Supercomputing Center, Generador de Riqueza
Barcelona Supercomputing Center, Generador de RiquezaFacultad de Informática UCM
 
byteLAKE's Alveo FPGA Solutions
byteLAKE's Alveo FPGA SolutionsbyteLAKE's Alveo FPGA Solutions
byteLAKE's Alveo FPGA SolutionsbyteLAKE
 
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06ManhHoangVan
 
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...Chris Fregly
 
The Case for a Signal Oriented Data Stream Management System
The Case for a Signal Oriented Data Stream Management SystemThe Case for a Signal Oriented Data Stream Management System
The Case for a Signal Oriented Data Stream Management SystemReza Rahimi
 
Design of Scalable FFT architecture for Advanced Wireless Communication Stand...
Design of Scalable FFT architecture for Advanced Wireless Communication Stand...Design of Scalable FFT architecture for Advanced Wireless Communication Stand...
Design of Scalable FFT architecture for Advanced Wireless Communication Stand...IOSRJECE
 
Multi-core GPU – Fast parallel SAR image generation
Multi-core GPU – Fast parallel SAR image generationMulti-core GPU – Fast parallel SAR image generation
Multi-core GPU – Fast parallel SAR image generationMahesh Khadatare
 

Ähnlich wie Times Series Feature Extraction Methods of Wearable Signal Data for Deep Learning Computer Vision Applications (20)

Targeting GPUs using OpenMP Directives on Summit with GenASiS: A Simple and...
Targeting GPUs using OpenMP  Directives on Summit with  GenASiS: A Simple and...Targeting GPUs using OpenMP  Directives on Summit with  GenASiS: A Simple and...
Targeting GPUs using OpenMP Directives on Summit with GenASiS: A Simple and...
 
FORECASTING MUSIC GENRE (RNN - LSTM)
FORECASTING MUSIC GENRE (RNN - LSTM)FORECASTING MUSIC GENRE (RNN - LSTM)
FORECASTING MUSIC GENRE (RNN - LSTM)
 
Iaetsd pipelined parallel fft architecture through folding transformation
Iaetsd pipelined parallel fft architecture through folding transformationIaetsd pipelined parallel fft architecture through folding transformation
Iaetsd pipelined parallel fft architecture through folding transformation
 
Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...
Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...
Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...
 
Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...
Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...
Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...
 
The CAOS framework: democratize the acceleration of compute intensive applica...
The CAOS framework: democratize the acceleration of compute intensive applica...The CAOS framework: democratize the acceleration of compute intensive applica...
The CAOS framework: democratize the acceleration of compute intensive applica...
 
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
 
2007 Tidc India Profiling
2007 Tidc India Profiling2007 Tidc India Profiling
2007 Tidc India Profiling
 
Zd n2010 son-in_4g_mobile_networks (1)
Zd n2010 son-in_4g_mobile_networks (1)Zd n2010 son-in_4g_mobile_networks (1)
Zd n2010 son-in_4g_mobile_networks (1)
 
byteLAKE's expertise across NVIDIA architectures and configurations
byteLAKE's expertise across NVIDIA architectures and configurationsbyteLAKE's expertise across NVIDIA architectures and configurations
byteLAKE's expertise across NVIDIA architectures and configurations
 
INDUSTRIAL TRAINING REPORT
INDUSTRIAL TRAINING REPORTINDUSTRIAL TRAINING REPORT
INDUSTRIAL TRAINING REPORT
 
Barcelona Supercomputing Center, Generador de Riqueza
Barcelona Supercomputing Center, Generador de RiquezaBarcelona Supercomputing Center, Generador de Riqueza
Barcelona Supercomputing Center, Generador de Riqueza
 
byteLAKE's Alveo FPGA Solutions
byteLAKE's Alveo FPGA SolutionsbyteLAKE's Alveo FPGA Solutions
byteLAKE's Alveo FPGA Solutions
 
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
 
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
 
Gene's law
Gene's lawGene's law
Gene's law
 
The Case for a Signal Oriented Data Stream Management System
The Case for a Signal Oriented Data Stream Management SystemThe Case for a Signal Oriented Data Stream Management System
The Case for a Signal Oriented Data Stream Management System
 
Design of Scalable FFT architecture for Advanced Wireless Communication Stand...
Design of Scalable FFT architecture for Advanced Wireless Communication Stand...Design of Scalable FFT architecture for Advanced Wireless Communication Stand...
Design of Scalable FFT architecture for Advanced Wireless Communication Stand...
 
Influx data basic
Influx data basicInflux data basic
Influx data basic
 
Multi-core GPU – Fast parallel SAR image generation
Multi-core GPU – Fast parallel SAR image generationMulti-core GPU – Fast parallel SAR image generation
Multi-core GPU – Fast parallel SAR image generation
 

Kürzlich hochgeladen

Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...amitlee9823
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 

Kürzlich hochgeladen (20)

Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 

Times Series Feature Extraction Methods of Wearable Signal Data for Deep Learning Computer Vision Applications

  • 1. Copyright © SAS Institute Inc. All rights reserved. Human Activity Recognition in Python: Signal Analysis & Feature Extraction Methods Utilizing Fourier and Wavelet Transformations Compiled & Presented by William Nadolski Based upon Jupyter Notebook created by Ahmet Taspinar
  • 2. Copyright © SAS Institute Inc. All rights reserved. Presentation Agenda • Human Activity Recognition Dataset - Introduction to the data and classification task - Performance of traditional feature extraction approaches for signal analysis • Fourier Analysis - Brief introduction to the Fast Fourier Transform (FFT) - Feature extraction using the FFT - Disadvantages of the FFT • Wavelet Analysis - Introduction to Wavelets - Spectrogram creation using the Continuous Wavelet Transform (CWT) • Train a deep learning convolutional neural network model (DLCNN) on CWT-derived Spectrogram Images Using Keras Python API • Potential Applications
  • 3. Copyright © SAS Institute Inc. All rights reserved. Human Activity Recognition (HAR) Dataset Download Data • Consists of tri-axial accelerometer, gyroscope, and total acceleration data collected via waist-worn smartphone while performing six different activities • Data is sampled at 50 Hz and segmented into 10,299 distinct windows of 128 samples (2.56 sec each) and pre-split 70/30 into train/test subsets • Data has been pre-processed and standardized to remove noise • Goal is to classify activity using only the nine signal components Data Citation: Davide Anguita, Alessandro Ghio, Luca Oneto, Xavier Parra and Jorge L. Reyes-Ortiz. A Public Domain Dataset for Human Activity RecognitionUsing Smartphones. 21th European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning, ESANN 2013. Bruges, Belgium 24-26 April 2013 Image Citation: http://ataspinar.com/wp-content/uploads/2018/01/3d_plot.png 9 Signal Components 128 Samples
  • 4. Copyright © SAS Institute Inc. All rights reserved. Traditional ML Approach Model Training Using Python sklearn 1. Load and plot the data 2. Extract summary statistics for each signal component within each record - Min | Max | Mean | Median | Std Dev | Skew | Kurt 3. Iteratively model using different classifiers
  • 5. Copyright © SAS Institute Inc. All rights reserved. Introduction to Fourier Transform What is it and how can it be leveraged for machine learning? The Fourier Transform decomposes a stationary time series signal into its constituent frequencies. Allows us to convert the signal from the time domain to the frequency domain and extract potentially useful features. Fast Fourier Transform (FFT) is synonymous w/ Discrete Fourier Transform (DFT) Fourier Equation: https://betterexplained.com/wp-content/uploads/images/DerivedDFT.png Fourier Visual: https://www.nti-audio.com/portals/0/pic/news/FFT-Time-Frequency-View-540.png
  • 6. Copyright © SAS Institute Inc. All rights reserved. Fast Fourier Transform in Python Simulating and Decomposing a Composite Signal • Create a composite signal from five constituent sine waves • Decompose into Fourier magnitude and Power Spectral Density (PSD)
  • 7. Copyright © SAS Institute Inc. All rights reserved. Feature Extraction Using FFT in Python Return to HAR Dataset • Example of applying the FFT to each signal component • Interested in identifying the local maxima of the FFT & PSD functions • Specifically interested in extracting the (f, a) coordinates for each peak
  • 8. Copyright © SAS Institute Inc. All rights reserved. Feature Extraction Using FFT in Python Returning to HAR Dataset • No longer using traditional descriptive statistics • Instead identify local maxima based on FFT of the signal component • Wish to extract both the frequency and amplitude for top N peaks • One set for FFT coefficient peaks and another set based on PSD values • Using only top 3 peaks, we should expect the following features per record: • 9 components X top 3 peaks X 4 coordinates (f,p for FFT and f,p for PSD) = 108 features • If no peak present, impute zero value 108 features Image: http://ataspinar.com/wp-content/uploads/2018/01/signal_to_matrix2.png f = frequency P = power (amplitude)
  • 9. Copyright © SAS Institute Inc. All rights reserved. Feature Extraction Using FFT in Python Returning to HAR Dataset • Again, iterate over 10 different classifiers using scikit-learn FFT provides a 3.4% point boost in accuracy compared to basic summary stats approach!
  • 10. Copyright © SAS Institute Inc. All rights reserved. El Niño Data Limitations of the Fast Fourier Transform • Example: El Niño quarterly sea surface temperature from 1870-1996
  • 11. Copyright © SAS Institute Inc. All rights reserved. El Niño Data Limitations of the Fast Fourier Transform Suggests a seasonality of 2-8 years (0.125 – 0.50 Hz) Wikipedia: El Niño phases are known to occur close to four years, however, records demonstrate that the cycles have lasted between two and seven years. • Example: El Niño quarterly sea surface temperature from 1870-1996
  • 12. Copyright © SAS Institute Inc. All rights reserved. Introduction to Wavelets What are they and how can it be leveraged for machine learning? • Wavelets: Localized in time with finite energy and zero mean • Instead of frequency, uses frequency bands referred to as scales • Wavelet Transform involves convolving a time series signal with a “mother” wavelet at different scales (frequencies) Sine vs. Wavelet: http://ataspinar.com/wp-content/uploads/2018/07/Wavelet-Out1.jpg Wavelet Transform GIF: http://ataspinar.com/wp-content/uploads/2018/12/wavelet_convolution_3d_2d_final.gif Image: http://ataspinar.com/wp-content/uploads/2018/08/Comparisonoftransformations.jpg
  • 13. Copyright © SAS Institute Inc. All rights reserved. El Niño Data Continuous Wavelet Transform (CWT) • Wavelet transform is used in many digital signal processing tasks such as audio filtering, data compression, image analysis, etc. • Allows us to generate a 2D image of the signal called a spectrogram • Generate spectrogram from El Niño data
  • 14. Copyright © SAS Institute Inc. All rights reserved. Continuous Wavelet Transform CWT Spectrogram of El Nino Data • Shows power of a signal across different frequencies at different points in time • Allows us to visualize changes over time within the frequency domain • Shaded area corresponds to cone of influence
  • 15. Copyright © SAS Institute Inc. All rights reserved. Continuous Wavelet Transform Returning to HAR Dataset • Going to train a CNN on each set of 9 spectrogram images via Keras in Python • Extract 128x128 pixel spectrogram of each signal component for each record • RGB images have 3 channels, we’ll just treat each signal component as its own channel
  • 16. Copyright © SAS Institute Inc. All rights reserved. Convolutional Neural Network for HAR Classification Utilizing Keras API within Python • Modified LeNet architecture utilized: - 1. Produce 32 feature maps using a 5x5 kernel with ReLu activation - 2. Apply max pooling of size 2x2 with a 2x2 stride - 3. Apply a dropout layer with probability 2.5% - 4. Produce 64 feature maps using a 5x5 kernel with ReLu activation - 5. Apply max pooling of size 2x2 - 6. Apply a dropout layer with probability 2.5% - 7. Flatten the feature maps for each recording - 8. Pass through a fully connected layer of 1,000 nodes - 9. Apply dropout layer with probability 50% - 10. Apply a softmax activation function to predict class label CNN Architecture: http://ataspinar.com/wp-content/uploads/2018/12/9layer_image_CNN.png def train_CNN(batch_size=64, epochs=100, lr=0.0001): model = Sequential() model.add(Conv2D(32, kernel_size=(5, 5), strides=(1, 1), activation='relu’, input_shape=(127,127,9))) model.add(MaxPooling2D(pool_size=(2, 2), strides=(2, 2))) model.add(Dropout(0.025)) model.add(Conv2D(64, (5, 5), activation='relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Dropout(0.025)) model.add(Flatten()) model.add(Dense(1000, activation='relu')) model.add(Dropout(0.50)) model.add(Dense(num_classes, activation='softmax')) model.compile(loss=keras.losses.categorical_crossentropy, optimizer=keras.optimizers.Adam(lr=lr, decay=0.0, amsgrad=False), metrics=['accuracy']) model.fit(Xtrain_CWT, Ytrain_CWT, batch_size=batch_size, epochs=epochs, verbose=1, validation_data=(Xtest_CWT, Ytest_CWT), callbacks=[history])
  • 17. Copyright © SAS Institute Inc. All rights reserved. Convolutional Neural Network for HAR Classification Model Performance Over Time • Obtained a maximum test accuracy of 96.1% with an average of ~95.5% • Achieved +6.11% point increase in classification accuracy using CWT over FFT! Epoch 71/100: 5000/5000 [==============================] train_loss: 0.0026 – train_acc: 0.9998 - val_loss: 0.3205 - val_acc: 0.9565 Epoch 72/100: 5000/5000 [==============================] train_loss: 0.0048 – train_acc: 0.9984 - val_loss: 0.3162 - val_acc: 0.9610 Epoch 73/100: 5000/5000 [==============================] train_loss: 0.0060 – train_acc: 0.9994 - val_loss: 0.3653 - val_acc: 0.9535 Comparison of different methods
  • 18. Copyright © SAS Institute Inc. All rights reserved. Potential Applications • IoT signal analysis • Wearable medical devices • Audio processing and analysis • Image analysis and computer vision tasks • Defect detection based on manufacturing machine sensors • Supplement existing time series modelling approaches • Data compression and dimensionality reduction techniques • Data smoothing and signal denoising
  • 19. Copyright © SAS Institute Inc. All rights reserved. Summary of Analysis • Reviewed attributes of the HAR dataset and visualized sensor data • Extracted traditional summary statistics for use in modeling • Iterated over numerous classifiers to assess baseline model accuracy • Fast Fourier Transformation • Introduced the concept of the Fourier Transform • Extracted FFT-derived features from the HAR dataset • Improved model accuracy using only the FFT-derived features • Illustrated some of the limitations and disadvantages of the FFT • Wavelet Transformation • Introduced the concept of the Wavelet Transformation and its benefits • Used the CWT to create a spectrogram and visualize the El Nino dataset • Used CWT-derived spectrograms of HAR data to train a CNN with Keras
  • 20. Copyright © SAS Institute Inc. All rights reserved. Questions?