1

Background Information I am newer to coding, and have been working on mask rcnn (modified faster rcnn) project to identify Stryker Miltary Vehicles in images. I trained the maskrcnn network with no problems with the help of matlab's mask rcnn training example and matlab answers, but when I tried to run the function detectMaskRCNN I am getting errors. The main error is that after running lines 39-45 in the Matlab's detectMaskRCNN funciton the YRCNNReg variable and the bboxes are not the same size. I know that it is the YRCNNReg variable that is not the correct size after reading the documentation YRCNNReg is supposed to be [numClasses*4 numObs]. I tried walking through the code of how YRCNNReg was created in the function but I couldn't understand what was happening in the multiple layers. What I do know is that both variables are using numClasses but YRCNNReg is including the background class while bboxes doesn't. For example YRCNNReg size is 8x1000 single and bboxes is a 1000x4 single. The params parameter that is passed in indicates that the numClasses to detect is 1. So I am not sure how to fix this size discrepancy. Thanks so much for your help!

Question So my question is "how can I get YRCNNReg to be the correct size? Where in the process caused this discrepancy happen?"

Reference Link: https://www.mathworks.com/help/deeplearning/ug/instance-segmentation-using-mask-rcnn.html

This is similar to the training example that I used to train my neural network but I changed what classes are trying to be identified.

Error:

Arrays have incompatible
sizes for this operation.

Error in
helper.applyRegression
(line 24)
    gx = boxIn(:,3).*x +
    px; % center position

Error in detectMaskRCNN
(line 93)
bboxes =
helper.applyRegression(bboxes,
reg, params.MinSize,
params.MaxSize);

detectMaskRCNN Code that is being ran:

line 38: % Run prediction on the inputs

line 39: [bboxes, YRCNNClass, YRCNNReg, featureMap] = predict(...

line 40:                                        dlnet, X, 'Outputs', outputNodes);

line 41:           
                         
line 42 % Extract data from the output dlarrays

line 43: bboxes = extractdata(bboxes)';

line 44: YRCNNClass = extractdata(YRCNNClass);

line 45: YRCNNReg = extractdata(YRCNNReg);

...

line 93: bboxes = helper.applyRegression(bboxes, reg, params.MinSize,params.MaxSize);

https://github.com/matlab-deep-learning/mask-rcnn/blob/main/detectMaskRCNN.m

Vista
  • 11
  • 1

0 Answers0