How to get groundtruth.mat file of PPE dataset or label images

3 ビュー (過去 30 日間)
Itachi Engineer
Itachi Engineer 2022 年 4 月 15 日
編集済み: firdaus mohamed 2022 年 4 月 26 日
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 件のコメント
firdaus mohamed
firdaus mohamed 2022 年 4 月 26 日
編集済み: firdaus mohamed 2022 年 4 月 26 日
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),:);

サインインしてコメントする。

回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by