How to get groundtruth.mat file of PPE dataset or label images
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am implementing MATLAB 2021a examle "Object Detection Using YOLO v4 Deep Learning" but I want to use my own dataset. In example the vehicleDatasetGroundTruth.mat file was already given how can I made my own dataset file (Personal protective equipment grounttruth.at file)
A small piece of code from example is mentioned below:
%...............Code..................................%
unzip vehicleDatasetImages.zip
data = load("vehicleDatasetGroundTruth.mat");
vehicleDataset = data.vehicleDataset;
%%
rng("default");
shuffledIndices = randperm(height(vehicleDataset));
idx = floor(0.6 * length(shuffledIndices) );
trainingIdx = 1:idx;
trainingDataTbl = vehicleDataset(shuffledIndices(trainingIdx),:);
validationIdx = idx+1 : idx + 1 + floor(0.1 * length(shuffledIndices) );
validationDataTbl = vehicleDataset(shuffledIndices(validationIdx),:);
testIdx = validationIdx(end)+1 : length(shuffledIndices);
testDataTbl = vehicleDataset(shuffledIndices(testIdx),:);
%.................................................................................................................................................%
1 Commento
firdaus mohamed
il 26 Apr 2022
Modificato: firdaus mohamed
il 26 Apr 2022
1. You need to create a ground truth dataset using, e.g., Image Labeler, (in define ROI Labels, select Rectangle, see Example how to use it).
2. Export to Workspace and name it as PersonalProtectiveEquipmentGroundtruth. Then, save that as a new PersonalProtectiveEquipmentGroundtruth (it will export in .mat file) in command window with
% save (your desired file name) (variable from Workspace)
% in this case I use same name for easy to use with the Yolo v4 Example
save PersonalProtectiveEquipmentGroundtruth PersonalProtectiveEquipmentGroundtruth
3. Remove line unzip vehicleDatasetImages.zip
Replace:
data = load("PersonalProtectiveEquipmentGroundtruth.mat");
PersonalProtectiveEquipmentGroundtruth = data.PersonalProtectiveEquipmentGroundtruth;
%%
rng("default");
shuffledIndices = randperm(height(PersonalProtectiveEquipmentGroundtruth));
idx = floor(0.6 * length(shuffledIndices) );
trainingIdx = 1:idx;
trainingDataTbl = PersonalProtectiveEquipmentGroundtruth(shuffledIndices(trainingIdx),:);
validationIdx = idx+1 : idx + 1 + floor(0.1 * length(shuffledIndices) );
validationDataTbl = PersonalProtectiveEquipmentGroundtruth(shuffledIndices(validationIdx),:);
testIdx = validationIdx(end)+1 : length(shuffledIndices);
testDataTbl = PersonalProtectiveEquipmentGroundtruth(shuffledIndices(testIdx),:);
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!