MATLAB Answers

0

Faster RCNN label problem

Asked by fortunion on 10 May 2018
Latest activity Answered by Tunai Marques on 11 Oct 2019
Hi, I tried to train fasterRCNNObjectDetector using this tutorial: https://www.mathworks.com/help/vision/examples/object-detection-using-faster-r-cnn-deep-learning.html However after run there is a NaN value in Mini-batch Loss. I have set initial weigths and bias for convolutional layers and this problem disappeared. After detector finished training I try to detect vehicle on some test images using in training process. However there is an error:
Subscript indices must either be real positive integers or logicals.
Error in fasterRCNNObjectDetector/getScoreAssociatedWithLabel (line 637) scores = allScores(ind)';
Error in fasterRCNNObjectDetector/detect (line 515) scores = getScoreAssociatedWithLabel(this, labels, allScores);
Why this error appear?

  0 Comments

Sign in to comment.

3 Answers

Answer by YANGYANG LIU on 28 Feb 2019
Edited by YANGYANG LIU on 28 Feb 2019

Wash data and label.

  0 Comments

Sign in to comment.


Answer by Tunai Marques on 2 Oct 2019

Hi,
I was able to train the tutorial example, but when I used my own images, the mini-batch loss became NaN. You mentioned that you changed the initialization weights, and so did I:
featureExtractionNetwork = resnet50;
tmp_net = featureExtractionNetwork.saveobj;
tmp_net.Layers(2,1).Weights = gpuArray(single(randn([7 7 3 64])*0.0001));
tmp_net.Layers(2,1).Bias = gpuArray(single(randn([1 1 64])*0.00001+1));
featureExtractionNetwork = featureExtractionNetwork.loadobj(tmp_net);
Still I keep getting NaN in the mini-batch loss. Any toughts on how to solve it?

  0 Comments

Sign in to comment.


Answer by Tunai Marques on 11 Oct 2019

Just a quick update: my problem was that the resized images (originally 5k x 3k pixels) turned the original bounding boxes into too small BBs. The first few convolutional layers of resnet50 (which I am using for feature extraction) were then killing all the useful data (by downsampling the already super small bounding boxes).
In order to fix the problem, I first did a somewhat smart crop on the original images (and adjusted the bouding boxes accordingly), so that the new bounding boxes in the resized images were not so small. Now it works!
Hope that helps.

  0 Comments

Sign in to comment.