Step 2:
Split
the data into two parts: 1) use 70% of the data for training (52
images) and 30% for validation (to make sure that your network has been
trained properly).
clear;
clc;
close all;
mydata = imageDatastore('MerchData', ... % load data from folder named 'MerchData'
'IncludeSubfolders',true,
...
% Also include the subfolders (there are 5
of these for the 5 objects, cap, cube, ...)
'LabelSource','foldernames');
% The name of the subfolders supply the "correct answer" labels
[mydataTrain,mydataValidation] = splitEachLabel(mydata,0.7);
mydataTrain and mydataValidation are now two new variables containing images for training of the network and validation.