Question about MATLAB Mask RCNN code from github.

9 views (last 30 days)
DaeYoung
DaeYoung on 12 Mar 2021
Answered: Prabhan Purwar on 6 Aug 2021
Hello, I am trying to test the code, 'Mask RCNN with MATLAB' on the external website, 'https://github.com/matlab-deep-learning/mask-rcnn'.
I have a question on the function, [rpnTrainingSamples.m] , 41~50 line.
The code is :
=====================================================================================
% Sub-sample negative samples to avoid using too much memory.
numPos = sum(positiveIndex);
negIdx = find(negativeIndex);
numNeg = numel(negIdx);
nidx = params.RandomSelector.randperm(numNeg, min(numNeg, 5000));
% Pack data as int32 to save memory.
regionProposals = int32([regionProposals(positiveIndex, :); regionProposals(nidx, :)]);
anchorIDs = {int32([anchorIDs(positiveIndex) anchorIDs(nidx)])};
anchorIndices = {int32([anchorIndices(positiveIndex,:); anchorIndices(nidx,:)])};
=====================================================================================
The above packed data will be used for training samples of RPN.
However, for the negative samples of regionProposals (and anchorIDs, etc..), those with indices 'nidx' are packed.
As I know of, the variable 'nidx' is just a randomly shuffled numbers in the range of [1, numNeg].
So, I am afraid that 'regionProposals(nidx, :)' may not represent the negative samples but all the samples (positive, negative, ignored).
Is it right?
Thank you!

Answers (1)

Prabhan Purwar
Prabhan Purwar on 6 Aug 2021
Hi,
Thanks for reporting the issue. As a workaround kindly consider replacing nidx with numNeg(nidx) in the above code. I have bought the issue to the notice of our developer and will try to fix it in future releases.
Thanks

Community Treasure Hunt

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

Start Hunting!

Translated by