Is it possible to use sequence input in CNN without using cell arrays?
3 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!