how to prepare the data set for boxLabelDatastore function using image labler APP

8 vues (au cours des 30 derniers jours)
Josh
Josh le 22 Sep 2023
Commenté : Ali le 15 Juin 2024
I have a data set prepared by image labler APP. The format of the bounding box is different to the example showing on the matlab page.
I wrote some codes to convert them, but not very successful. There are either single or double quotation marks in my table and
The boxLabelDatastore report an error message as below:
Error using boxLabelDatastore>iAssertValidBBoxFormat
The size of bounding box data must be M-by-4, M-by-5, or M-by-9, where M is the number of boxes in each table element. The column in the training data table that contains the bounding boxes must be a cell array.
My questions are:
1) How could I convert them into a cell array without ' or ''
2) Is there a easy way to label image and produce the dataset that mataches the example data set?
Regards
data_snail = load('340Ann.mat');
imageFilename = data_snail.gTruth.DataSource;
% imageFilename = cell2table(imageFilename);
snaillist = data_snail.gTruth.LabelData.snail;
for i =1:length(snaillist)
tmp=snaillist{i};
rowStrings = arrayfun(@(row) strjoin(arrayfun(@(x) num2str(x), tmp(row, :), 'UniformOutput', false), ', '), 1:size(tmp, 1), 'UniformOutput', false);
if size(tmp,1)>1
resultString = strjoin(rowStrings, '; ');
else
resultString = rowStrings;
end
column(i,1) = string(imageFilename{i});
resultString = strcat('[', resultString, ']');
column(i,2) = string(resultString);
resultString=[];
end
snailDataset = array2table(column, 'VariableNames', {'imageFilename', 'snail'});
snailDataset.snail=cellstr(snailDataset.snail);

Réponses (1)

T.Nikhil kumar
T.Nikhil kumar le 4 Oct 2023
Hello Josh,
I understand that you want to create a “training Data” table from the “groundTruth” object generated by using the Image Labeler App to create a YOLOv2 object Detector.
This can be done in a simple way by using the “objectDetectorTrainingData” function that takes “groundTruth” type object and returns a “trainingDataTable” that can be used for implementation object detection using YOLOv2.
trainingDataTable = objectDetectorTrainingData(gTruth);
You can refer to the following documentation to understand about the objectDetectorTrainingData” function.
Hope this helps!

Catégories

En savoir plus sur Recognition, Object Detection, and Semantic Segmentation dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by