Effacer les filtres
Effacer les filtres

My Custom Deep learning Layer is giving me an error

5 vues (au cours des 30 derniers jours)
Muhammad Nabi
Muhammad Nabi le 15 Sep 2019
I am using CNN of time series data from 8 channels with 500 time samples. My Deep learning architecture consists of the following layers. In the First step i perform 1D convolution across the channels (input size [500 8 1 ])so I get 16, [500 x 1 ] arrays and the output size becomes [500 x 1 x 16].
I wrote a custom function to reshape its size to [500 x 16 ] but it gives me an error when i train the network.
please just see the pictures and help me out. I have tried my best to explain it as far as I can. Thanks
Picture1.png
When I Analyzed the network using analyzeNetwork(layers). It showed that my Architecture is correct Here are the results of it
Capture.JPG
But When I start training the Network It gives me the following error
Capture.JPG
Here is the code to the Reshape Layer which I wrote:
classdef reshapeLayer < nnet.layer.Layer
properties
end
methods
function layer = reshapeLayer(Name)
layer.Name = Name;
end
function [Z] = predict(layer, X)
sz = [size(X,1) size(X,2)*size(X,3) size(X,4)];
Z = reshape(X , sz);
end
function [dldx] = backward(layer,~,~,dldz,~)
sz = [size(dldz,1) , 1 , size(dldz,2) , size(dldz,3)];
dldx = reshape(dldz , sz);
end
end
end
  1 commentaire
Paola HUMBERT
Paola HUMBERT le 8 Juin 2020
Hello,
Could you find the error in your code ? The answer would interest me.
Thank you.

Connectez-vous pour commenter.

Réponses (1)

Lucas Teng
Lucas Teng le 7 Août 2020
Update your matlab version to at least 2020a and enter the following code into command:
edit(fullfile(matlabroot,'examples','nnet','main','projectAndReshapeLayer.m'))
You'll learn it.

Catégories

En savoir plus sur Image Data Workflows 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!

Translated by