Data Augmentation for images and bounding boxes in Object Detection
7 次查看(过去 30 天)
显示 更早的评论
Hello all,
I am trying to apply data augmentation on a object detection dataset created with Image Labeler App in MATLAB. As explained in https://fr.mathworks.com/help/deeplearning/ug/object-detection-using-yolo-v2.html, the trainingData which is a table containing imageFilename and the bouding boxes coordinates of definite object classes is augmented, with a defined augmentation function (augmentData found in the same link), using:
augmentedTrainingData = transform(trainingData,@augmentData);
I am trying to apply the same line of code after labeling my own dataset and creating the trainingData from the gTruth saved with:
trainingData = objectDetectorTrainingData(gTruth,'SamplingFactor',1, 'WriteLocation','TrainingData');
Although I followed the same concept explained, when using transform function, I am getting the error below:
Undefined function 'transform' for input arguments of type 'table'.
augmentedTrainingData = transform(trainingData,@augmentData);
How can I apply data augmentation on trainingData? I am using MATLAB R2019a.
Appreciate any kind of help. Thank you in advance !!
0 个评论
回答(1 个)
Seth Furman
2022-5-23
objectDetectorTrainingData must be called with 2 outputs in order for the first output to be an image datastore and not a table.
imageDir = fullfile(matlabroot,'toolbox','vision','visiondata','vehicles');
addpath(imageDir);
data = load('vehicleTrainingGroundTruth.mat');
gTruth = data.vehicleTrainingGroundTruth;
vehicleDetector = load('yolov2VehicleDetector.mat');
lgraph = vehicleDetector.lgraph;
% imds is an image datastore.
[imds,~] = objectDetectorTrainingData(gTruth)
% trainingDataTable is a table.
trainingDataTable = objectDetectorTrainingData(gTruth)
3 个评论
David
2022-11-8
Andrea,
Did you ever figure this out? I am at that juncture myself. Any help would be greatly appreciated.
Thanks in advance,
Dave
Amanjit Dulai
2022-11-8
You should just be able to call objectDetectorTrainingData directly on an object with the class groundTruth.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!