12345678910111213141516171819202122232425262728293031323334353637 |
- clear all
- close all
- clc
- imgSz=28; % square image pixel size
- N=6e4; % Number of pictures to label
- %% Reading Binary Training Images
- fileOffset = 16; % bytes of file offset
- fileID = fopen('../Data/train-images.idx3-ubyte');
- Xset = fread(fileID,imgSz^2*N+fileOffset,'uint8');
- Xset = Xset(fileOffset+1:end);
- fclose(fileID);
- %% Reading Binary Training Labels
- fileOffsetL = 8; % bytes of file offset
- fileIDL = fopen('../Data/train-labels.idx1-ubyte');
- Xl = fread(fileIDL,N+fileOffsetL,'uint8');
- Xl = Xl(fileOffsetL+1:end);
- fclose(fileIDL);
- %% Building 3D matrix with N images
- Xmat = Vector2PictureMatrix(imgSz, N, Xset);
- %% Showing images
- figure()
- suptitle('Ordered chosen pictures from the Testing Data Set')
- for kk=1:10
- subplot(2, 5, kk)
- ind=find(Xl==kk-1,1,'first');
- imshow(255-Xmat(:,:,ind),[0 255])
- xlabel(int2str(Xl(ind)));
- end
|