-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadin_digit_dataset.m
More file actions
27 lines (25 loc) · 1.09 KB
/
loadin_digit_dataset.m
File metadata and controls
27 lines (25 loc) · 1.09 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
27
clear;
load('tsukubaHand24x24.mat');
% [XTrain,YTrain,~] = digitTrain4DArrayData;
% [XTest,YTest,~] = digitTest4DArrayData;
% trainData = orzReshape(squeeze(XTrain), 1);
% testData = orzReshape(squeeze(XTest), 1);
% trainLabels = YTrain;
% testLabels = YTest;
% trainData = convertDatasetToMatlabSubspaceFormat(trainData, trainLabels);
% testData = convertDatasetToMatlabSubspaceFormat(testData, testLabels);
trainData = testData;
imageSize = 24;
data = reshape(trainData, imageSize, imageSize, size(trainData, 2), size(trainData, 3));
figure; % Create a new figure window
for i = 1:30 % Loop through each of the 10 classes
% random integer, used to display random image
idx = randi([1, 100]);
img = squeeze(data(:,:,1,i)); % Extract the first 16x16 image of the i-th class
subplot(6, 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');