How to import the images into 2D array (one image per row)?
2 ビュー (過去 30 日間)
古いコメントを表示
I downloaded the DeepLearnToolbox-master and try to train the CNN. In the test_example_CNN.m,the train images are imported into 2D matrices (one image per row). I would like to train the CNN with my own images, but I don't know how to import the images into 2D array (one image per row). Please, explain me how to do it.
Thanks, May
% Load the MNIST hand-written digit dataset.
load mnist_uint8;
% Reshape the example digits back into 2D images.
%
% 'train_x' and 'test_x' begin as 2D matrices with one image per row.
% train_x [60000 x 784]
% test_x [10000 x 784]
%
% Also, rescale the pixel values from 0 - 255 to 0 - 1.
train_x = double(reshape(train_x',28,28,60000))/255;
test_x = double(reshape(test_x',28,28,10000))/255;
train_y = double(train_y');
test_y = double(test_y');
% You can use this command to display an example image. Note that the
% images need to be transposed in order to be oriented properly.
colormap gray;
imagesc(train_x(:, :, 105)');
axis square;
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Recognition, Object Detection, and Semantic Segmentation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!