SequenceinputLayer and Convolution2dLayer

4 views (last 30 days)
Chris Basic
Chris Basic on 27 Mar 2020
Answered: Katja Mogalle on 22 Jun 2022
I was told by the deep network designer that the SequenceinputLayer and Convolution2dLayer that these two layers are incompatible. I would like to know why and how I could have an input of a 1x29 double set up with a Convolution2dLayer and have two classifications.

Answers (2)

Zhiyu WANG
Zhiyu WANG on 22 Jun 2022
It`s recommended to transform your data to formatted dlarray objects at first.
As for the dlarray object, you can refer to this:
"Convolution2dLayer" needs at least 2 "spatial" dimensions
"SequenceinputLayer " needs at least 1 "time" dimension

Katja Mogalle
Katja Mogalle on 22 Jun 2022
From what you write, Chris, my understanding is that you want to perform 1D convolutions on sequence data (e.g. time series). From R2021b onwards, you can do this via sequenceInputLayer combined with convolution1dLayer. For an example, see here: https://uk.mathworks.com/help/deeplearning/ug/sequence-classification-using-1-d-convolutions.html
If this is not what you're trying to do, could you please provide some more context about your problem and what your data dimensions mean? You can also include a screenshot from the network analysis (e.g. using analyzeNetwork or Deep Network Designer).
As Zhiyu WANG mentioned, a convolution2dLayer generally expects two dimensions to convolve over. Typically, these are two spatial dimensions. But from R2022a you can also convolve over a mix of dimensions (e.g. spatial and sequence dimensions).

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!