Convolution Neural Network on my dataset

2 ビュー (過去 30 日間)
Muhammad Usman
Muhammad Usman 2017 年 11 月 27 日
回答済み: Javier Pinzón 2017 年 12 月 1 日
Hey all, My data set contains around 1200 entries. Each entry contains 81 images in it. I have one folder (it contains 81 images for one record) and a class label against it. I am confused, how do I give it to my CNN?
Thanks Already!

回答 (1 件)

Javier Pinzón
Javier Pinzón 2017 年 12 月 1 日
Hello Muhammad,
Iif i understood, you have 1200 categories, and 81 data information in each category, split in folders.
If you what to get the categories, the best way i to locate ALL the category folders in 1 main folder, for example "/training/" folder, i that way you can get all the Folders labels automatically using this code line:
%%Training Dataset
location = '*path*/training';
imds = imageDatastore(location,'IncludeSubfolders',1,'LabelSource','foldernames');
*path is the complet address to get the training folder. It will give you all the data directions and labels writen en each folder.
To enter it to the CNN, you can use this other part:
trainingDS = imds;
% Convert labels to categoricals
trainingDS.Labels = categorical(trainingDS.Labels);
So you get a imagedatastore variable with "categories", and finally, enter it to the network with your defined layers and options:
[net, info] = trainNetwork(trainingDS, layers, opts);
Hope it helps, and thanks if this answer is accepted.
Any question, feel free to ask.
Regards,
Javier

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by