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