MATLAB Answers

Lacking Understanding for boxLabelDatastore command

11 views (last 30 days)
Matpar
Matpar on 11 Dec 2019
Answered: Srivardhan Gadila on 18 Feb 2020
Hi All,
I am working on a Fast RCNN example and i am finding it challenging to move forward from my errors.
everytime I run my code I keep getting an error
can a someone with greater experience assit me please? Thank you in advance for acknowledging my digital presence.
This the error!!!!
Undefined function or variable 'boxLabelDatastore'.
Error in trainFastRCNNObjectDetector (line 19)
blds = boxLabelDatastore(stopSigns(:,2:end));
This is my code:
%% 1 Loading Data
data = load('rcnnStopSigns.mat', 'stopSigns', 'fastRCNNLayers');
stopSigns = data.stopSigns;
fastRCNNLayers = data.fastRCNNLayers;
%% 2 Add Full Path To Image Files
stopSigns.imageFilename = fullfile(toolboxdir('vision'),'visiondata', ...
stopSigns.imageFilename);
%% 3 Randomly shuffling Data For Training
rng(0);
shuffledIdx = randperm(height(stopSigns));
stopSigns = stopSigns(shuffledIdx,:);
%% 4 Creating ImageDatastore Utilising Table Files
imds = imageDatastore(stopSigns.imageFilename);
%% 5 Creating A BoxLabelDatastore Utilising Label Columns From The Table
blds = boxLabelDatastore(stopSigns(:,2:end));
%% 6 Combining the Datastores
ds = combine(imds, blds);
%% 7 Applying Preprocessing/Resizing Image & Boxes For Predefined Size
ds = transform(ds,@(data)preprocessData(data,[920 968 3]));
%% 8 Setting Network Training Options
options = trainingOptions('sgdm', ...
'MiniBatchSize', 10, ...
'InitialLearnRate', 1e-3, ...
'MaxEpochs', 10, ...
'CheckpointPath', tempdir);
%% 9 Training The Fast R-CNN Detector
frcnn = trainFastRCNNObjectDetector(ds, fastRCNNLayers , options, ...
'NegativeOverlapRange', [0 0.1],'PositiveOverlapRange', [0.7 1]);
%% 10 Testing The Fast R-CNN Detector On Test Image
img = imread('stopSignTest.jpg');
%% 11 Running The Detector Results
detectedImg = insertObjectAnnotation(img,'rectangle',bbox,score);
figure
imshow(detectedImg)

  0 Comments

Sign in to comment.

Answers (1)

Srivardhan Gadila
Srivardhan Gadila on 18 Feb 2020
The function boxLabelDatastore is introduced in R2019b release. Please use the function in MATLAB R2019b.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by