-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadin_digit_dataset.asv
More file actions
26 lines (24 loc) · 1.07 KB
/
loadin_digit_dataset.asv
File metadata and controls
26 lines (24 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
clear;
load('cifar10.mat');
% [XTrain,YTrain,~] = digitTrain4DArrayData;
% [XTest,YTest,~] = digitTest4DArrayData;
% trainData = orzReshape(squeeze(XTrain), 1);
% testData = orzReshape(squeeze(XTest), 1);
% trainLabels = YTrain;
% testLabels = YTest;
% trainData = convertkkkDatasetToMatlabSubspaceFormat(trainData, trainLabels);
% testData = convertDatasetToMatlabSubspaceFormat(testData, testLabels);
imageSize = 32;
data = reshape(trainData, imageSize, imageSize, size(trainData, 2), size(trainData, 3));
figure; % Create a new figure window
for i = 1:10 % Loop through each of the 10 classes
% random integer, used to display random image
idx = randi([1, 100]);
img = squeeze(data(:,:,idx,i)); % Extract the first 16x16 image of the i-th class
subplot(2, 5, i); % Arrange the plots in a 2x5 grid
imagesc(img); % Display the image
axis square; % Make each subplot square in shape
colormap gray; % Use grayscale colors
title(sprintf('Class %d', i)); % Title each subplot with its class number
end
% save('rotated_digits_mnist.mat', 'trainData', 'testData');