How to predict with 1Dconvolution layers: get 3 channels to produce one output?
Hello there I am tying to build a model to test what a 1D convolution layer will do to my data. I have 3 input accelerometer mesurements in the x,y,z directions and am trying to predict a continuous output. The Xtrain is a 3×500 double with the 3 input accelerometer mesurements over 500 time steps and the Ytrain is a 1×500 double of the target output variable. The code I have developed is here:
numFilters = 64;
filterSize = 5;
droupoutFactor = 0.005;
numBlocks = 4;
dilationFactor = 1;
net = dlnetwork;
layers = sequenceInputLayer(NumFeatures,Normalization="rescale-symmetric",Name="inputaccelerometers")
convolution1dLayer(filterSize,numFilters,DilationFactor=dilationFactor,Padding="causal",Name="conv1_")
net = addLayers(net,layers)
options = trainingOptions("adam", …
MaxEpochs=60, …
miniBatchSize=1, …
InputDataFormats="CTB", …
Plots="training-progress", …
Metrics="rmse", …
Verbose=0);
net = trainnet(Xtrain’,Ytrain’,net,"mse",options)
But when I try and train the model I get and error that says: Number of channels in predictions (3) must match the number of channels in the targets (1). Do I need to add another layer to convert the inputs into one predicted output and which layer should I use to do this? Any suggestions on how to remove this error and get the network to run accurately? Thanks so much!Hello there I am tying to build a model to test what a 1D convolution layer will do to my data. I have 3 input accelerometer mesurements in the x,y,z directions and am trying to predict a continuous output. The Xtrain is a 3×500 double with the 3 input accelerometer mesurements over 500 time steps and the Ytrain is a 1×500 double of the target output variable. The code I have developed is here:
numFilters = 64;
filterSize = 5;
droupoutFactor = 0.005;
numBlocks = 4;
dilationFactor = 1;
net = dlnetwork;
layers = sequenceInputLayer(NumFeatures,Normalization="rescale-symmetric",Name="inputaccelerometers")
convolution1dLayer(filterSize,numFilters,DilationFactor=dilationFactor,Padding="causal",Name="conv1_")
net = addLayers(net,layers)
options = trainingOptions("adam", …
MaxEpochs=60, …
miniBatchSize=1, …
InputDataFormats="CTB", …
Plots="training-progress", …
Metrics="rmse", …
Verbose=0);
net = trainnet(Xtrain’,Ytrain’,net,"mse",options)
But when I try and train the model I get and error that says: Number of channels in predictions (3) must match the number of channels in the targets (1). Do I need to add another layer to convert the inputs into one predicted output and which layer should I use to do this? Any suggestions on how to remove this error and get the network to run accurately? Thanks so much! Hello there I am tying to build a model to test what a 1D convolution layer will do to my data. I have 3 input accelerometer mesurements in the x,y,z directions and am trying to predict a continuous output. The Xtrain is a 3×500 double with the 3 input accelerometer mesurements over 500 time steps and the Ytrain is a 1×500 double of the target output variable. The code I have developed is here:
numFilters = 64;
filterSize = 5;
droupoutFactor = 0.005;
numBlocks = 4;
dilationFactor = 1;
net = dlnetwork;
layers = sequenceInputLayer(NumFeatures,Normalization="rescale-symmetric",Name="inputaccelerometers")
convolution1dLayer(filterSize,numFilters,DilationFactor=dilationFactor,Padding="causal",Name="conv1_")
net = addLayers(net,layers)
options = trainingOptions("adam", …
MaxEpochs=60, …
miniBatchSize=1, …
InputDataFormats="CTB", …
Plots="training-progress", …
Metrics="rmse", …
Verbose=0);
net = trainnet(Xtrain’,Ytrain’,net,"mse",options)
But when I try and train the model I get and error that says: Number of channels in predictions (3) must match the number of channels in the targets (1). Do I need to add another layer to convert the inputs into one predicted output and which layer should I use to do this? Any suggestions on how to remove this error and get the network to run accurately? Thanks so much! neural network, convolution layer, input MATLAB Answers — New Questions