How do I edit a gTruth object if I mislabelled the label?

23 ビュー (過去 30 日間)
Joseph Rivera
Joseph Rivera 2018 年 5 月 22 日
回答済み: Anand 2018 年 6 月 4 日
I've been using groundTruthLabeler a LOT and I was wondering how I can edit Labels in the gTruth object that I'm creating from exporting the labels into a .mat file. It's created as read-only..

回答 (2 件)

Joseph Rivera
Joseph Rivera 2018 年 5 月 24 日
I figured it out. So even though matlab says that the ground truth object gTruth that you export from groundTruthLabeler is read only, you can extract all of the contents i.e. gTruth.DataSource .LabelDefinitions and .LabelData and save them as variables of the same name in your workspace. Then, go into LabelDefinitions and LabelData and change the name of the label that you mislabeled i.e. sedan to hummer. Then you can use the groundTruth() function to put those three back into a ground truth object.

Anand
Anand 2018 年 6 月 4 日
Here is some pseudo-code to help anyone else who wants to do this.
% Load old groundTruth MAT file
load oldGTruth;
% Extract data from old ground truth.
dataSource = oldGTruth.DataSource;
labelDefs = oldGTruth.LabelDefinitions;
labelData = oldGTruth.LabelData;
% Replace oldName with newName
% oldName = 'Car'; newName = 'Sedan';
labelDefs.Name = strrep(labelDefs.Name, oldName, newName);
labelData.Properties.VariableNames = strrep(labelData.Properties.VariableNames, oldName, newName);
% Create new groundTruth object
newGTruth = groundTruth(dataSource, labelDefs, labelData);

Community Treasure Hunt

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

Start Hunting!

Translated by