Spliting ground truth data into 70% training, 20% validation and 10% Testingdata

1 回表示 (過去 30 日間)
Abdussalam Elhanashi
Abdussalam Elhanashi 2020 年 5 月 21 日
Hi guys
i am looking for spliting data from ground truth file for following code
70% training, 20% validation and 10% Testingdata
load('gTruth.mat')
Fruits = selectLabels(gTruth,{'orange','Apple'});
if isfolder(fullfile('ExperimentData'))
cd ExperimentData
else
mkdir ExperimentData
end
addpath('ExperimentData');
splitFolder = true;
if splitFolder
valFolderName = "ExperimentData";
files = dir(fullfile(valFolderName));
N = length(files);
tf=randperm(N)>(0.20*N);
mkdir TrainingData;
mkdir ValidationData;
mkdir TestingData;
for i=3:length(tf)
files_re = files(i).name;
if tf(i) == 3
copyfile (fullfile(valFolderName,files_re),'TrainingData')
else
copyfile (fullfile(valFolderName,files_re),'Validation')
ifelse
copyfile (fullfile(valFolderName,files_re),'TestingData')
end
end
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeAutomotive についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by