Faster RCNN label problem

3 次查看(过去 30 天)
fortunion
fortunion 2018-5-10
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?

回答(3 个)

YANGYANG LIU
YANGYANG LIU 2019-2-28
编辑:YANGYANG LIU 2019-2-28
Wash data and label.

Tunai Marques
Tunai Marques 2019-10-2
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 2019-10-11
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 个评论
vishnu priya
vishnu priya 2020-2-10
please let me know how you did smart crop and bounding boxes

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by