mnist数据集转换bmp图片

Mat格式mnist数据集下载地址:http://www.cs.nyu.edu/~roweis/data.html

Matlab转换代码:

load('mnist_all.mat');
type = 'train';
savePath = 'G:\data\mnist\train\';
for num = ::
numStr = num2str(num);
tempNumPath = strcat(savePath, numStr);
mkdir(tempNumPath);
tempNumPath = strcat(tempNumPath,'\');
tempName = [type, numStr];
tempFile = eval(tempName);
[height, width] = size(tempFile);
for r = ::height
tempImg = reshape(tempFile(r,:),,)';
tempImgPath = strcat(tempNumPath,num2str(r-));
tempImgPath = strcat(tempImgPath,'.bmp');
imwrite(tempImg,tempImgPath);
end
end
上一篇:通过数据库表自动生成POJO(JavaBean)对象


下一篇:symfony2 twig模板引擎