load '/MATLAB Drive/RLE/G_truth/gTruth.mat'
[imds,pxdsTruth] = pixelLabelTrainingData(gTruth)
dsTrain = combine(imds,pxdsTruth);
trainingData_2 = combine(imds,pxdsTruth);
tbl = countEachLabel(pxdsTruth)
frequency = tbl.PixelCount/sum(tbl.PixelCount);
classes = ["Quemado","Mate","Estriado","Aspero","Blanquecino","Deposito","Fondo"];
numClasses = numel(classes);
lgraph = deeplabv3plusLayers(imageSize, numClasses, "resnet18");
options = trainingOptions('sgdm', ...
'LearnRateSchedule','piecewise',...
'LearnRateDropPeriod',12,...
'LearnRateDropFactor',0.3,...
'InitialLearnRate',1e-3, ...
'L2Regularization',0.005,...
'Shuffle','every-epoch', ...
'CheckpointPath', tempdir, ...
'Plots','training-progress',...
'ValidationPatience', 4);
[net] = trainNetwork(dsTrain,lgraph,options);