Expanding Deep Network Architecture for Signal Classification
4 views (last 30 days)
Show older comments
I have implemented a code for classifying P, QRS, T, and NA segments from ECG signals. The current network architecture consists of a sequence input layer, an LSTM layer, and fully connected layers for classification. However, I would like to enhance the performance of the network by incorporating convolutional neural network (CNN) layers to capture more informative features from the ECG signals.
Here is the existing code that I have:
input_data = fsstTrainData(:, 1);
target_data = fsstTrainData(:, 2);
size_input = size(input_data); %cell 315*1
size_input_signals = size(input_data{1, 1}); %double 40*5000
size_target = size(target_data); %cell 315*1
size_target_signals = size(target_data{1, 1}); %categorical 1*5000
layers = [
sequenceInputLayer(size_input_signals(1))
lstmLayer(200, 'OutputMode', 'sequence')
fullyConnectedLayer(class_num)
softmaxLayer
classificationLayer];
trainNetwork(input_data, target_data, layers, options);
I would appreciate any assistance in modifying the network architecture to incorporate CNN layers that can extract more informative features from the signals. Your suggestions and guidance would be highly valuable in improving the classification accuracy.
Thank you for your help!
0 Comments
Answers (2)
Aniketh
on 9 Jul 2023
Edited: Aniketh
on 9 Jul 2023
In order to answer your question how you can incorporate CNN layers to your architecture it is quite straight forward, here is one short example to give you an idea:
cnn_layers = [
imageInputLayer([size_input_signals(1), size_input_signals(2), 1])
convolution2dLayer([3, 3], 16, 'Padding', 'same')
reluLayer
maxPooling2dLayer(2, 'Stride', 2)
convolution2dLayer([3, 3], 32, 'Padding', 'same')
reluLayer
maxPooling2dLayer(2, 'Stride', 2)
];
lstm_layers = [
sequenceInputLayer(size_input_signals(1))
lstmLayer(200, 'OutputMode', 'sequence')
fullyConnectedLayer(class_num)
softmaxLayer
classificationLayer
];
layers = [
cnn_layers
sequenceFoldingLayer('Name', 'fold')
lstm_layers
];
As for increasing the accuracy/enhancing the performance, you should know these are really empirical methods, just adding more layers or introducing more complex architectures such as this would not necessarily produce better results and might even produce worse results.
Try and experiment on your own, changing the parameters and different architectural changes see what works best for your case, I would suggest reading up on how DL architectures are popularly used for processing ECG Signals, I believe MathWorks has a lot of resources on this as well.
Hope this helped!
0 Comments
Abolfazl Nejatian
on 10 Jul 2023
2 Comments
Aniketh
on 10 Jul 2023
Apologies for the confusion, as I mentioned it was just an example to get you started, the dimensions would not match in the template I gave, having a look at it, the dimensions should be 1/4th the original dimension passed to the CNN, but further in the code you would have to be mindful and check carefully for dimensions.
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!