"Unable to find any region proposals to use as positive training samples." using trainFastRCNNObjectDetector
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm using the following code to try and train a R-CNN to recognize the sun in images taken with a low-res camera:
data = load('nn.mat');
Sources = data.gTruth.DataSource.Source;
Bounding = data.gTruth.LabelData;
trainingData = horzcat(Sources,Bounding);
[h w] = size(importdata('18-07-20-16-24-11-0-Lepton-fc491d.csv'));
classes = {'first', 'second'};
outputs = 1+numel(classes); % +1 for background class
layers = [imageInputLayer([h w 1])
convolution2dLayer([1 1],5)
reluLayer()
averagePooling2dLayer(2,'Stride',2)
fullyConnectedLayer(outputs)
softmaxLayer()
classificationLayer()];
options = trainingOptions('sgdm', ...
'MiniBatchSize', 10, ...
'InitialLearnRate', 1e-6);
maybe = trainFastRCNNObjectDetector(trainingData,layers,options,'PositiveOverlapRange',[0.0001 1],'NegativeOverlapRange',[0.00001 0.0001]);
When I run this, I get the following in the command window:
>> SIMF_object_detection
*******************************************************************
Training a Fast R-CNN Object Detector for the following object classes:
* SUN
--> Extracting region proposals from 54 training images...done.
Error using vision.internal.cnn.fastrcnn.RegionReader (line 153)
Unable to find any region proposals to use as positive training samples. Lower the first value of
PositiveOverlapRange to increase the number of positive region proposals.
Error in vision.internal.cnn.fastrcnn.TrainingRegionDispatcher (line 67)
vision.internal.cnn.fastrcnn.RegionReader(...
Error in fastRCNNObjectDetector/createTrainingDispatcher (line 730)
dispatcher = vision.internal.cnn.fastrcnn.TrainingRegionDispatcher(...
Error in fastRCNNObjectDetector.train (line 180)
dispatcher = createTrainingDispatcher(...
Error in trainFastRCNNObjectDetector (line 200)
[detector, ~, ~, info] = fastRCNNObjectDetector.train(trainingData, layers, options, params,
checkpointSaver);
Error in SIMF_object_detection (line 25)
maybe = trainFastRCNNObjectDetector(trainingData,layers,options,'PositiveOverlapRange',[0.0001
1],'NegativeOverlapRange',[0.00001 0.0001]);
I've tried adjusting the positive and negative overlap ranges, but I still get the same error message..I'm not sure if I'm missing something simple, but some help would be much appreciated.
0 commentaires
Réponses (3)
AnaM
le 4 Nov 2020
Hello!!
Did you manage how to solve this issue? I am facing the same problem..
Thank you!!
0 commentaires
Claudio Eutizi
le 20 Jan 2021
Hello, have you fixed this issue? I'm looking for the solution...
0 commentaires
Sunny Guha
le 28 Avr 2022
Hi folks,
One reason for this message is that the bounding box lables might be too small compared to the image dimensions (<2% of the image size). Object detectors struggle in detecting smaller objects and probably is unable to find any objects matching with groundTruth.
I noticed that the network you have is not deep enough. Neural networks need to be deep to be able to extract meaningful features since they are heierarchical learners. I recomment using FasterRCNN over FastRCNN as FasterRCNN is end2end.
You can utilize the fasterrcnnlayer function to create a FasterRCNN network with a pre-trained backbone (https://www.mathworks.com/help/vision/ref/fasterrcnnlayers.html).
The pre-trained backbones are deep and are pre-trained on ImageNet dataset for 1000-class classification. This created network can then be finetuned on your dataset.
Example demonstrating this with Resnet50 backbone
If however you still encounter issues when detection smaller objects, here are some additional things to try
1. Choose a different backbone/featureLayer. (Requires a bit of experimentation)
The spatial size of the featureLayer directly affects the granularity of the object detector. The bigger the size of featureLayer, the better it performs on smaller objects.
As a simple example,
featureExtractionNetwork = resnet18('Weights','none');
featureLayer = 'res2b_relu';
2. Increast the bounding box sizes. (Easiest fix)
Increases the bounding box size by ~ 3x sometimes resolves this issue. This can be done by a simple transform function on the bounding box datastore.
I hope that choosing a different backbone and using fasterRCNNlayers function resolves the issues.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!