May I ask how to add SE net in LSTM for for time series prediction?
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How to add SE net in LSTM for for time series prediction?
0 commentaires
Réponses (1)
Subhajyoti
le 30 Nov 2024
It is my understanding that you are trying to integrate a Squeeze-and-Excitation (SE) block into an LSTM network for time series prediction in MATLAB. You can create a custom function to implement the SE block logic for LSTM outputs, and modify the LSTM Network to include the SE block after the LSTM Layer.
You can refer to the following implementation for reference.
1. Define the SE BLock as a custom layer:
function seLayer = seBlock(numHiddenUnits, name)
seLayer = [
fullyConnectedLayer(numHiddenUnits, 'Name', [name '_fc1'])
reluLayer('Name', [name '_relu'])
fullyConnectedLayer(numHiddenUnits, 'Name', [name '_fc2'])
sigmoidLayer('Name', [name '_sigmoid'])
];
end
2. Define the network layers:
% Define the sequence input layer
inputLayer = sequenceInputLayer(1, 'Name', 'input');
% Define the LSTM layer
lstmLayer = lstmLayer(50, 'OutputMode', 'sequence', 'Name', 'lstm');
% Define the SE block with the same number of units as the LSTM
seLayer = seBlock(50, 'se');
% Define the fully connected and regression layers
fcLayer = fullyConnectedLayer(1, 'Name', 'fc');
regressionLayer = regressionLayer('Name', 'output');
3. Finally, you can contruct the network using these layers:
% Construct the layer graph
layers = [
inputLayer
lstmLayer
seLayer
fcLayer
regressionLayer
];
net = dlnetwork;
net = addLayers(net, layers);
% analyzeNetwork(net)
The above code snippet generated the following network:
% Create a layer graph
lgraph = layerGraph(layers);
% Display the layer graph
plot(lgraph);
Refer to tthe following MathWorks Documentation to know more about Deep Learning Networks in MATLAB:
3 commentaires
Subhajyoti
le 1 Déc 2024
I implemented the model, as illustrated in the original paper "Squeeze-and-Excitation Networks".
You can tweak the implementation for your requirements.

Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
