'Error using roialign' when training maskrcnn model

조회 수: 10 (최근 30일)
David
David 2022년 8월 22일
답변: Spruha 2025년 4월 23일
When using the trainMaskRCNN() function, I get the error
Warning: Empty Proposals. Skipping training step
Error using roialign
Invalid argument at position 2. Value must not be empty.
Error in maskrcnn/roiAlignPooling (line 19)
outFeatures = roialign(X, squeeze(boxes), poolSize, 'ROIScale', 1);
Error in maskrcnn/forward (line 550)
dlPooled = roiAlignPooling(obj, dlX, dlProposals, obj.PoolSize);
Error in images.dltrain.internal.SerialTrainer>modelGradients (line 133)
[networkOutputs{:},state] = forward(net,inputs{:});
Error in deep.internal.dlfeval (line 17)
[varargout{1:nargout}] = fun(x{:});
Error in dlfeval (line 40)
[varargout{1:nargout}] = deep.internal.dlfeval(fun,varargin{:});
Error in images.dltrain.internal.SerialTrainer/fit (line 76)
[loss,grad,state,networkOutputs,lossData] = dlfeval(@modelGradients,self.Network,self.LossFcn,...
Error in images.dltrain.internal.dltrain (line 102)
net = fit(networkTrainer);
Error in trainMaskRCNN (line 240)
[network,info] = images.dltrain.internal.dltrain(mbqTrain,network,options,lossFcn,metrics,'Loss',
'ExperimentMonitor',params.ExperimentMonitor);
Error in fibers_train (line 86)
[net,info] = trainMaskRCNN(ds,net,options);
Does anyone have any idea of what could be the cause of this, and what I can do about it?
  댓글 수: 1
Hanqing
Hanqing 2022년 10월 4일
Had similar issue with this function and the same a warning before this particular function.
I did not find a way to solve this. But there are some walk around solutions for me to deal with my own problem.
One thing is to change the initial training step to a lower value. Other training parameters like the 'Momentum' should also have some influence on the results.
Then if the training still goes wrong, you can select only part of your training datasets. In my case, some of my samples are more easiler to trigger this problem than the other ones.

댓글을 달려면 로그인하십시오.

답변 (1개)

Spruha
Spruha 2025년 4월 23일
Hi David,
I see you are trying to train a Mask R-CNN instance segmentation network using ‘trainMaskRCNN()’ and are encountering the following errors:
  • Warning: Empty Proposals. Skipping training step
  • Invalid argument at position 2. Value must not be empty
This error typically occurs when the region proposal network fails to generate any valid region proposals, resulting in empty proposals during training.
As a workaround, I recommend using 'SOLOv2' instead of Mask R-CNN. 'SOLOv2' provides a more robust solution for instance segmentation, as it does not rely on region proposals. This means you can avoid errors related to empty proposals entirely.
Please refer to this documentation of SOLOv2: https://in.mathworks.com/help/vision/ref/solov2.html
Hope this helps!

카테고리

Help CenterFile Exchange에서 Recognition, Object Detection, and Semantic Segmentation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by