フィルターのクリア

How can I prepare my dataset to fed into a stacked Autoencoder

5 ビュー (過去 30 日間)
debojit sharma
debojit sharma 2023 年 6 月 9 日
回答済み: Ranjeet 2023 年 6 月 27 日
I am trying to implement stacked autoencoder for image classification. But I am not able to understand how can I prepare my dataset to fed into a autoencoder. As it is being said in this link that we need to reshape the training images into a matrix, how can it be done? Please provide a sample code.

回答 (1 件)

Ranjeet
Ranjeet 2023 年 6 月 27 日
Hi Debojit,
The guidance on how to prepare dataset to fed into a stacked network has been provided in the following example
However, I am rewriting the sample code that serves the purpose –
% Get the number of pixels in each image
imageWidth = 28;
imageHeight = 28;
inputSize = imageWidth*imageHeight;
% Load the test images
[xTestImages,tTest] = digitTestCellArrayData;
% Turn the test images into vectors and put them in a matrix
xTest = zeros(inputSize,numel(xTestImages));
for i = 1:numel(xTestImages)
xTest(:,i) = xTestImages{i}(:);
end
whos xTest xTestImages;
Name Size Bytes Class Attributes xTest 784x5000 31360000 double xTestImages 1x5000 31880000 cell
size(xTestImages{1})
ans = 1×2
28 28
You may find the code snippet in the example as well. The second last line in the code converts an image ‘xTestImages{i} into a vector and store in a matrix ‘xTest.

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by