Spliting ground truth data into 70% for training, 30% for Validation
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi
i want to know how to split Data ( training, validation) from ground truth file generated by ground truth labeler application i need for example 70% for training 30% for validation
This is in order to implement validationData in training option to get validation loose curve
in my code , i was able only to do TrainingData, but i cant make Validation to be avaliable for ValidationData in training option
Herein the code
load('gTruth.mat')
socialdistencedetection = selectLabels(gTruth,'cars');
if isfolder(fullfile('TrainingData'))
cd TrainingData
else
mkdir TrainingData
end
addpath('TrainingData');
inputLayer = imageInputLayer([224 224 3],'Name','input','Normalization','none');
filterSize = [3 3];
middleLayers = [
convolution2dLayer(filterSize, 16, 'Padding', 1,'Name','conv_1',...
'WeightsInitializer','narrow-normal')
batchNormalizationLayer('Name','BN1')
reluLayer('Name','relu_1')
maxPooling2dLayer(2, 'Stride',2,'Name','maxpool1')
convolution2dLayer(filterSize, 32, 'Padding', 1,'Name', 'conv_2',...
'WeightsInitializer','narrow-normal')
batchNormalizationLayer('Name','BN2')
reluLayer('Name','relu_2')
maxPooling2dLayer(2, 'Stride',2,'Name','maxpool2')
convolution2dLayer(filterSize, 64, 'Padding', 1,'Name','conv_3',...
'WeightsInitializer','narrow-normal')
batchNormalizationLayer('Name','BN3')
reluLayer('Name','relu_3')
maxPooling2dLayer(2, 'Stride',2,'Name','maxpool3')
convolution2dLayer(filterSize, 128, 'Padding', 1,'Name','conv_4',...
'WeightsInitializer','narrow-normal')
batchNormalizationLayer('Name','BN4')
reluLayer('Name','relu_4')
maxPooling2dLayer(2, 'Stride',2,'Name','maxpoo4')
convolution2dLayer(filterSize, 256, 'Padding', 1,'Name','conv_5',...
'WeightsInitializer','narrow-normal')
batchNormalizationLayer('Name','BN5')
reluLayer('Name','relu_5')
];
lgraph = layerGraph([inputLayer; middleLayers]);
imageSize = [224 224 3];
Anchors = [
102 15
170 29
191 41
122 29
45 11
96 21
137 21
];
options = trainingOptions('sgdm', ...
'InitialLearnRate',0.01, ...
'Verbose',true,'MiniBatchSize',16,'L2Regularization',0.06,'MaxEpochs',80,...
'Shuffle','every-epoch','VerboseFrequency',50, ...
'DispatchInBackground',true,...
'ExecutionEnvironment','auto','ValidationData',Validation);
trainingData = objectDetectorTrainingData(socialdistencedetection,'SamplingFactor',1,...
'WriteLocation','TrainingData');
numClasses = size(trainingData,2)-1;
lgraph = yolov2Layers([224 224 3],numClasses,Anchors,lgraph,'relu_5');
analyzeNetwork(lgraph);
[detectorYolo2, info] = trainYOLOv2ObjectDetector(trainingData,lgraph,options);
save('detectorYolo2.mat','detectorYolo2');
% For Training Loss
x = 1:size(info.TrainingLoss,2);
y = info.TrainingLoss;
figure
plot(x,y)
title('Training Phase')
xlabel('Iteration')
ylabel('Mini Batch Training Loss')
댓글 수: 0
채택된 답변
Swetha Polemoni
2020년 12월 18일
Hi Abdussalam Elhanashi
It is my understand that you want to create a dataset from existing data for validation purpose. You may find the documentation Save and Load Parts of Variables in MAT-Files useful in creating new mat file which is a part of existing one.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Motor Drives에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!