1D Regression with CNN

조회 수: 17 (최근 30일)
João M. Lopes
João M. Lopes 2020년 3월 17일
댓글: Hiro Yoshino 2020년 6월 1일
How should I treat my input matrix and target matrix for 1D regression problem with CNN?
Suppose I have EMG signals with 760000 points (samples) and I've collected data from 8 muscles (features). So, I have a matrix 760000-by-8. My target is a matrix 760000-by-1. Imagine that I have 1 trial for each 5 persons. So, I'll have for each person a 760000-by-8 matrix.
1)
In the documentation, it says that CNN treats the input data as an image, so it expects an input like h-by-w-by-c-by-N.
In this case, should I consider my features as the number of channels or the width of my input "image"? And N should be 5?
I.e., should I rearrage my training data as 760000-by-1-by-8-by-5 or 760000-by-8-by-1-by-5? Reading the documentation e some questions about this issue, I do not fully understand how should I give my data to the trainNetwork function.
2)
Another question is about the fully connected layer after the CNN feature extractor layers. After I have my feature maps, as this is a regression problem and my target is a 760000-by-1 signal, the output size of my fully connected layer should be 760000?
I'm always having a size issue, saying that it is required a very long array and matlab would become unresponsive.
Thanks in advance

채택된 답변

Hiro Yoshino
Hiro Yoshino 2020년 3월 17일
I skimmed through the issue - sorry if I am answering in a different direction.
You should convert the 1D data into image format as follows:
X_train = reshape(X_train', [1, 1, size(X_train,2), size(X_train,1)]);
X_train: 100 x 4 matrix meaning 100 samples x 4 features
Then you should use imageInputLayer as follows:
nFeatures = 4;
nHiddenUnits1 = 3;
nHiddenUnits2 = 3; % num of classes
nClasses = 3;
layers = [
imageInputLayer([1 1, nFeatures],"Name","imageinput") % この指定の仕方も最重要ポイント 2
fullyConnectedLayer(nHiddenUnits1,"Name","fc_1")
fullyConnectedLayer(nHiddenUnits2,"Name","fc_2")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
Hope this helps you out.
  댓글 수: 3
aybike pirol elmas
aybike pirol elmas 2020년 5월 31일
Hi,
similar problem.
my EMG data 2x174800 (so 2 input or channels) and target 1x174800. I will predict, not classification
The output size of my fully connected layer should be 174800?how will this be?
Hiro Yoshino
Hiro Yoshino 2020년 6월 1일
You may want to set the output number of the fullyconnectedlayer before the regression layer, which should be deployed at the end of the network, as 174800.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 AI for Signals에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by