Sunday 28 October 2018

mnistdeepauto analysis 7

% mnistdisp.m
% 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); % 784x30
% display a group of MNIST images
col=28;
row=28;

[dd,N] = size(digits); % 784x30
imdisp=zeros(2*28,ceil(N/2)*28); % 56, 420 pixel picture size

for nn=1:N % 1:30
  ii=rem(nn,2); if(ii==0) ii=2; end %% ii is line number 1rem1->1 2rem2=0->2 3->1 4->2
  jj=ceil(nn/2); % jj is digit sequence 1/2=1 2/2=1 3/2=2 4/2=2

  img1 = reshape(digits(:,nn),row,col); %reshape((784x1),28,28) = 28x28 nn=1..30
  img2(((ii-1)*row+1):(ii*row),((jj-1)*col+1):(jj*col))=img1'; % img2(nn=1 ->      0+1: 1*row,     0+1:1*col) = img1'
   %  img2(nn=2 -> 1*row+1: 2*row, 1*col+1:2*col) = img1'
end

imagesc(img2,[0 1]); colormap gray; axis equal; axis off;
drawnow;
err=0;