Azzera filtri
Azzera filtri

How to add more than a file gTruth using [imds,blds] = objectDete​ctorTraini​ngData(gTr​uth)

2 visualizzazioni (ultimi 30 giorni)
I did a dataset labeling two quirurgical tools on a few videos to a dataset to dentify this labels on the rest of them. I want to use more than a gTruth file fo train the net but didn't know how to add another gTruth file to train data. Some ideas about how to do that?

Risposte (1)

Kartik
Kartik il 18 Mag 2023
Hi,
To use multiple gTruth files to train your object detection network in MATLAB, you can create an array of the groundTruth objects using the "load" function in combination with a for loop.
Here's an example code snippet that shows how to load multiple gTruth files and combine them into a single "groundTruth" array:
% Define a cell array of file names
fileNames = {'gTruth1.mat','gTruth2.mat','gTruth3.mat'};
% Create an empty array of groundTruth objects
groundTruthArray = [];
% Loop over the file names and load each gTruth file
for i = 1:numel(fileNames)
load(fileNames{i},'gTruth');
groundTruthArray = [groundTruthArray;gTruth];
end
% Use objectDetectorTrainingData to create training data from the groundTruth array
[trainingData, detector] = objectDetectorTrainingData(groundTruthArray);
% Train your object detector using the training data and detector options
detector = trainRCNNObjectDetector(trainingData, detectorOptions);
In this example, we define a cell array of file names containing the names of our gTruth files. We then create an empty array of groundTruth objects and loop over the file names, using the "load" function to load each gTruth file and concatenating the resulting "gTruth" object to our "groundTruthArray".
After we have combined all the groundTruth objects into a single array, we can use the "objectDetectorTrainingData" function to create training data from the groundTruth array, and proceed with training our object detector using the combined training data and detector options.
Refer to the following MathWorks documentation for more information regarding "objectDetectorTrainingData":

Community Treasure Hunt

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

Start Hunting!

Translated by