필터 지우기
필터 지우기

Is it possible to use sequence input in CNN without using cell arrays?

조회 수: 2 (최근 30일)
Kamila Jankowska
Kamila Jankowska 2023년 7월 27일
답변: Shubham 2023년 7월 28일
I try to train CNN with 1D vector input data. The use of the feature input layer does not give high efficiency. Sequnce input layer requires data conversion to cell arrays, with the amount of data I have, it is impossible. Is there a workaround for this problem? I have matlab2021b. I tried to use 1D vector as image input layer [9 1 1]. Thanks to this, I get the appropriate effectiveness, but it is difficult to justify it in a scientific article.

답변 (1개)

Shubham
Shubham 2023년 7월 28일
Hi Kamila,
If you are working with 1D vector input data and want to train a CNN in MATLAB without using the sequence input layer, you can consider reshaping your data into a 2D matrix and using the image input layer. This approach allows you to leverage the existing functionality of CNNs in MATLAB while still working with your 1D data.
Here's an example of how you can reshape your 1D vector data into a 2D matrix and use it with the image input layer:
% Assuming your 1D vector data is stored in 'inputData'
inputData = [1, 2, 3, 4, 5, 6, 7, 8, 9];
% Reshape the 1D vector into a 2D matrix
reshapedData = reshape(inputData, [1, numel(inputData)]);
% Create the array datastore
ds = arrayDatastore(reshapedData);
% Create the image input layer with appropriate input size
imageInputSize = size(reshapedData);
imageInputLayer = imageInputLayer(imageInputSize);
% Create the rest of your CNN layers
...
% Train your CNN model
...
I hope, this will work.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by