Documentation on creating a box label datastore for bounding box label data with Sublabels?

10 次查看(过去 30 天)
Hello, I'm having trouble figuring how to train a fasterRCNN network using a labeled dataset I hand-labeled in Matlab with sublabels. I know how to create a boxLabelDatastore for just labeling 1 object but I can't figure out how to do this when I have sublabels. The error I get when I try to apply my old code for one object with no sublabels is as follows...
"Error using boxLabelDatastore
Invalid data in column 1 of input table 1.
Caused by:
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 thebounding boxes must be a cell array."
also this function does not work either...
[imds,blds] = objectDetectorTrainingData(gTruth)
Warning: groundTruth object/s contain attribute or sublabel data. These are not included in the output table.
> In objectDetectorTrainingData>populateTrainingTable (line 330)
In objectDetectorTrainingData (line 165)
I also have not been able to find any examples of going from a gTruth datastore to actually training a network in the examples

回答(1 个)

Sunny Guha
Sunny Guha 2022-5-24
Hi Ashley,
Apologies for the delayed response to your query, I just saw it.
If you have multiple objects to label the recommended approach is to have a separate labels (not sublabel) for each object. If you have sublabels associated to each labels currently objectDetectorTrainingData does not support the functionality of extracting the sublabels or attributes. However the good news is that this will change very soon and in the next release (22b) objectDetectorTrainingData will be able to extract sublabels and attributes as a third output.
However, for the time being let me suggest the following workaround.
  1. Loop over your grouthTruth data labels.
  2. Each entry for each label is a cell corresponding to each image. The cell contains a struct array corresponding to instances of each label. Each struct can further contain sublabels.
  3. Loop over each cell and each struct and extract Position values corresponding to labels and sublabels for each image.
  4. Convert this data to boxLabelDatastore or arrayDatastore.
Schematically this loop would like the following:
gt = gTruth;
out = [];
% List of labels
superClasses = ["label1","label2"];
% Loop over labels
for i=1:numel(superClasses)
sz = size(gt.LabelData.(superClasses(i)),1);
% Loop over data corresponding to each image
for j=1:sz
% Code to get positions of label and sublabels,
% would need to loop over the structs
out(j,i) = ...
end
end
  1 个评论
Ashley Cook
Ashley Cook 2022-5-27
Hi Sunny,
Thanks for your reply and for the workaround solution! This works but just out of curiosity do you know when 22b is set to release?
Thanks!
Ashley

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by