Convolution Neural Network on my dataset

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by