How to train a network with non-image data(MNIST)?

2 ビュー (過去 30 日間)
LINGJUN KONG
LINGJUN KONG 2017 年 7 月 20 日
コメント済み: LINGJUN KONG 2017 年 7 月 25 日
I'm trying to train a CNN for MNIST. As we all know, the MNIST data is not a image format. I have already trans them to a 60000*784 matrix. with a 60000*1 label. in libsvm we can use it directly and in the Neural Network toolbox(nnstart) could also use it directly.
But for a CNN network. the only training function is "trainNetwork" it could only support image for its input.
so how could i train the MNIST on Matlab? Must I translate all the 60000+10000 data back to image?

回答 (1 件)

Carl
Carl 2017 年 7 月 25 日
編集済み: Carl 2017 年 7 月 25 日
In order to train your CNN, you must provide the images in a 4D array. See the documentation here:
In the case of MNIST data, the images are 28x28, and have only 1 channel. There are 60000 images. Therefore, you want to pass the images as a 28x28x1x60000 array.
% X = 60000x784 array of MNIST data
X = reshape(X', 28, 28, 1, 60000);
See here for more on using the reshape function:
  1 件のコメント
LINGJUN KONG
LINGJUN KONG 2017 年 7 月 25 日
Thanks for your reply, it is useful

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeRecognition, Object Detection, and Semantic Segmentation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!