Created
May 30, 2019 12:19
-
-
Save gugarosa/5f8e9d6e6af67cacb01cc1ed479be187 to your computer and use it in GitHub Desktop.
It supposes that you have a pre-loaded MNIST matrix and creates a mosaic of random samples.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Check this repository to create your own MNIST Matlab's matrix | |
% https://github.com/daniel-e/mnist_octave/ | |
% Loading MNIST matrix file | |
load('mnist.mat'); | |
% Creating an empty array of 100 samples | |
A = zeros(28, 28, 1, 100, 'uint8'); | |
% Looping through 100 random samples | |
for i = 1:100 | |
% Gathering sample | |
I = trainX(i,:); | |
% Reshaping sample | |
I = reshape(I, [28, 28]).'; | |
% Applying sample to array | |
A(:,:,1,i) = I; | |
end | |
% Plotting montage | |
montage(A, 'size', [10 10]); | |
% Writing output | |
print('mnist.eps','-deps2', '-r300'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment