How can I prepare my dataset to fed into a stacked Autoencoder
조회 수: 5 (최근 30일)
이전 댓글 표시
With reference to this link https://in.mathworks.com/help/deeplearning/ug/train-stacked-autoencoders-for-image-classification.html
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.
댓글 수: 0
답변 (1개)
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;
size(xTestImages{1})
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’.
댓글 수: 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!