Faster RCNN label problem

2 views (last 30 days)
fortunion
fortunion on 10 May 2018
Commented: vishnu priya on 10 Feb 2020
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?

Answers (3)

YANGYANG LIU
YANGYANG LIU on 28 Feb 2019
Edited: YANGYANG LIU on 28 Feb 2019
Wash data and label.

Tunai Marques
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?

Tunai Marques
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.
  1 Comment
vishnu priya
vishnu priya on 10 Feb 2020
please let me know how you did smart crop and bounding boxes

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!