Clear Filters
Clear Filters

How do I configure labeled training data for trainFastR​CNNObjectD​etector()?

1 view (last 30 days)
I've created a set of labeled images in Matlab's imageLabeler app and exported them to my work space as a table data object.
data = load('buildingLabels.mat');
numClasses = 2;
trainingData = data.buildingLabels;
Here is what the training data looks like:
From here I set up an object detection net using instructions from: trainFastRCNNObjectDetector
When I run the code I get the error:
--> Extracting region proposals from 200 training images...Error using tabular/rowfun>dfltErrHandler
Applying the function '@(varargin)nSanitizeTrainingDataRow(varargin{:})' to the 1st row of A generated the following error:
Index in position 2 exceeds array bounds. Index must not exceed 1.
Since the code for the fastRCNN is basically copied over, I believe the issue is with my trainingData configuration but I'm not sure how to fix it.

Answers (1)

T.Nikhil kumar
T.Nikhil kumar on 21 Nov 2023
Hello Raymond,
I understand that you are facing an error while training a fastRCNNObjectDetector’ network based on Resnet-50 on your custom training Data.
The error message essentially suggests that there is an anomaly in the training data as you rightly pointed out.
The training data expected by the network is supposed to contain the bounding boxes as M-by-4 matrices where each row is of the form [x, y, width, height], where [x, y] represent the top-left coordinates of the bounding box and [width, height] represent the width and height of the bounding box. The labels should be a cell-array that contains M-by-1 categorical vectors with class names.
I can see that some of the bounding boxes and labels are empty in the training data. Therefore, I suggest you to either modify those entries or remove them.
Refer to the ‘trainingData’ section in the following documentation to understand more about the required format -
Hope this helps you proceed further!




Community Treasure Hunt

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

Start Hunting!