the function of trainMaskRCNN repot an error
Show older comments
hellow, everyon
I want to make a maskrcnn net for my data,
first I use Image Labeler

Second ,I make a dataStore,reference supporting documents

[imdsRGB,pxds]=pixelLabelTrainingData(gTruth);
[~,blds] = objectDetectorTrainingData(gTruth);
imdsMask=imageDatastore("PixelLabelData_2\", ...
"ReadFcn",@denseMasks)
imdsMask.Files=pxds.Files;
trainSet=combine(imdsRGB,blds,imdsMask);
function data=denseMasks(imds)
pixelLabelIDs=[1 3 4];%get from gtruth
h=480;%rgbImagesize
w=640;%rgbImagesize
numarray=numel(pixelLabelIDs);
Masksarray=false(h,w,numarray);
a=zeros(h,w);
I=imread(imds);
for i=1:numarray
n=pixelLabelIDs(i);
a(:)=n;
m=a==I;
Masksarray(:,:,i)=m;
end
data=Masksarray;
end
I think the data set I built is correct

Then,I construct a network
classnames={'Wheel','shallowRut','deepRut'};
inputsize=[480,640,3];
anchorBoxes=estimateAnchorBoxes(blds,3)
network = maskrcnn("resnet50-coco",classnames,anchorBoxes,"InputSize",inputsize)
Then,I make trainoption and start to train
do_train_maskRCN=1;
if do_train_maskRCN
options = trainingOptions("adam", ...
InitialLearnRate=0.001, ...
LearnRateSchedule="piecewise", ...
LearnRateDropPeriod=1, ...
LearnRateDropFactor=0.95, ...
Plots="training-progress", ...
MaxEpochs=10, ...
MiniBatchSize=3, ...
BatchNormalizationStatistics="moving", ...
ResetInputNormalization=false, ...
ExecutionEnvironment="gpu", ...
VerboseFrequency=50);
trainedDetector = trainMaskRCNN(trainSet,network,options);
end
The error is at the last code

I have consulted all the relevant support documentation, I don't know what the problem is, is there a problem with my data set Settings ?
Accepted Answer
More Answers (0)
Categories
Find more on Visual Perception in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
