-
Notifications
You must be signed in to change notification settings - Fork 72
/
mnistdisp.m
34 lines (28 loc) · 1.06 KB
/
mnistdisp.m
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
28
29
30
31
32
33
% Version 1.000
%
% Code provided by Ruslan Salakhutdinov and Geoff Hinton
%
% Permission is granted for anyone to copy, use, modify, or distribute this
% program and accompanying programs and documents for any purpose, provided
% this copyright notice is retained and prominently displayed, along with
% a note saying that the original programs are available from our
% web page.
% The programs and documents are distributed without any warranty, express or
% implied. As the programs were written for research purposes only, they have
% not been tested to the degree that would be advisable in any important
% application. All use of these programs is entirely at the user's own risk.
function [err] = mnistdisp(digits);
% display a group of MNIST images
col=28;
row=28;
[dd,N] = size(digits);
imdisp=zeros(2*28,ceil(N/2)*28);
for nn=1:N
ii=rem(nn,2); if(ii==0) ii=2; end
jj=ceil(nn/2);
img1 = reshape(digits(:,nn),row,col);
img2(((ii-1)*row+1):(ii*row),((jj-1)*col+1):(jj*col))=img1';
end
imagesc(img2,[0 1]); colormap gray; axis equal; axis off;
drawnow;
err=0;