Error using trainFaste​rRCNNObjec​tDetector

3 次查看(过去 30 天)
RCNN was working well i just change the function name to trainFasterRCNNObjectDetector and I have this error I dont understand as the algorithm success to traing the RPN ..
Error using vision.internal.cnn.fastrcnn.RegionReader (line 146) Unable to find any region proposals to use as positive or negative training samples.
*** | | | | _ _**********************************************************************
Training a Faster R-CNN Object Detector for the following object classes:
* stem
Step 1 of 4: Training a Region Proposal Network (RPN).
|=========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning|
| | | (seconds) | Loss | Accuracy | Rate |
|=========================================================================================|
| 1 | 1 | 73.10 | 0.7613 | 57.81% | 1.00e-04 |
| 1 | 50 | 3588.44 | 0.8843 | 49.21% | 1.00e-04 |
| 2 | 100 | 7138.63 | 0.8157 | 49.21% | 1.00e-04 |
| 3 | 150 | 10567.96 | 0.5309 | 90.48% | 1.00e-04 |
| 3 | 200 | 13992.71 | 0.4853 | 93.75% | 1.00e-04 |
| 4 | 250 | 17495.29 | 0.4534 | 95.31% | 1.00e-04 |
| 5 | 300 | 20907.92 | 0.5276 | 81.25% | 1.00e-04 |
| 5 | 350 | 24321.68 | 0.4508 | 95.31% | 1.00e-04 |
| 6 | 400 | 27764.91 | 0.4548 | 96.88% | 1.00e-04 |
| 7 | 450 | 31263.06 | 0.3596 | 95.31% | 1.00e-04 |
| 7 | 500 | 34683.48 | 0.4480 | 96.88% | 1.00e-04 |
| 8 | 550 | 38116.15 | 0.4450 | 92.06% | 1.00e-04 |
| 9 | 600 | 41608.04 | 0.3407 | 96.88% | 1.00e-04 |
| 9 | 650 | 45094.22 | 0.4522 | 96.88% | 1.00e-04 |
| 10 | 700 | 48521.79 | 0.3036 | 98.44% | 1.00e-04 |
| 10 | 730 | 50591.95 | 0.3237 | 98.44% | 1.00e-04 |
|=========================================================================================|
Step 2 of 4: Training a Fast R-CNN Network using the RPN from step 1.
*******************************************************************
Training a Fast R-CNN Object Detector for the following object classes:
* stem
--> Extracting region proposals from 92 training images...done.
Error using vision.internal.cnn.fastrcnn.RegionReader (line 146)
Unable to find any region proposals to use as positive or negative training samples.
Error in vision.internal.cnn.fastrcnn.TrainingRegionDispatcher (line 63)
vision.internal.cnn.fastrcnn.RegionReader(...
Error in fastRCNNObjectDetector/createTrainingDispatcher (line 667)
dispatcher = vision.internal.cnn.fastrcnn.TrainingRegionDispatcher(...
Error in fastRCNNObjectDetector.train (line 173)
dispatcher = createTrainingDispatcher(...
Error in trainFasterRCNNObjectDetector (line 297)
[~, fastRCNN] = fastRCNNObjectDetector.train(trainingData, fastRCNN, options(2), params, checkpointSaver);
Error in mainFast (line 47)
rcnnFaster = trainFasterRCNNObjectDetector(wheatT, convnet, options, ...__||||
  4 个评论
longbin yan
longbin yan 2018-1-27
https://cn.mathworks.com/matlabcentral/answers/354274-error-using-trainfastrcnnobjectdetector
Matpar
Matpar 2020-2-23
Hey Simon MADEC , I have been working on RCNN do you mine sharing your code here so that i can see where I went wrong in my exercise! I am trying to classify an object for a while and I am still have some challenges.
can you asssist please if you have a working code!
thanx

请先登录,再进行评论。

回答(6 个)

Simon MADEC
Simon MADEC 2017-5-17
I have found that the auto MinBoxSize is according by default to [105 105] but my regions have sometimes a size of [40 40] this [105 105] is with alexnet model why the default is not the to the minimum ?
Thanks a lot

azarm
azarm 2017-8-28
I have the same error! did you find a way though?

Kyle Webb
Kyle Webb 2017-8-28
There is definitely something going wrong with this function in MATLAB. I've generated some ground truth table, to debug just for one object class. The FasterRCNNObjectDetector passed the first 3 stages with high accuracy but fails at the 4th step. But then, a run the same code a few more times, and then suddenly it works without changing any input and clearing the workspace every run. If the input arguments of FasterRCNNObjectDetector the was wrong, it would fail every time, but this is not the case.
One of the lucky times:
Training a Faster R-CNN Object Detector for the following object classes:
D10
Step 1 of 4: Training a Region Proposal Network (RPN).
|=========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning|
| | (seconds) | Loss | Accuracy | Rate |
|=========================================================================================|
| 1 | 1 | 0.27 | 0.7420 | 58.06% | 1.00e-04 |
| 1 | 50 | 2.86 | 0.4674 | 93.75% | 1.00e-04 |
| 2 | 100 | 5.35 | 0.1598 | 100.00% | 1.00e-04 |
| 3 | 150 | 7.74 | 0.1689 | 100.00% | 1.00e-05 |
| 4 | 200 | 10.25 | 0.2533 | 100.00% | 1.00e-05 |
| 5 | 250 | 12.67 | 0.0867 | 100.00% | 1.00e-06 |
|=========================================================================================|
Step 2 of 4: Training a Fast R-CNN Network using the RPN from step 1.
*******************************************************************
Training a Fast R-CNN Object Detector for the following object classes:
* D10
--> Extracting region proposals from 50 training images...done.
|=========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning|
| | | (seconds) | Loss | Accuracy | Rate |
|=========================================================================================|
| 1 | 1 | 0.16 | 0.8390 | 100.00% | 0.0010 |
| 1 | 50 | 1.69 | 0.3630 | 100.00% | 0.0010 |
| 2 | 100 | 3.00 | 0.0643 | 100.00% | 0.0010 |
| 3 | 150 | 4.29 | 0.0136 | 100.00% | 0.0001 |
| 4 | 200 | 5.52 | 0.0029 | 100.00% | 0.0001 |
| 5 | 250 | 6.82 | 0.0040 | 100.00% | 1.00e-05 |
|=========================================================================================|
Step 3 of 4: Re-training RPN using weight sharing with Fast R-CNN.
|=========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning|
| | | (seconds) | Loss | Accuracy | Rate |
|=========================================================================================|
| 1 | 1 | 0.08 | 0.7309 | 75.00% | 1.00e-05 |
| 1 | 50 | 2.42 | 0.3999 | 93.75% | 1.00e-05 |
| 2 | 100 | 4.83 | 0.3563 | 93.75% | 1.00e-05 |
| 3 | 150 | 7.22 | 0.3202 | 100.00% | 1.00e-06 |
| 4 | 200 | 9.53 | 0.2477 | 100.00% | 1.00e-06 |
| 5 | 250 | 11.87 | 0.3382 | 96.77% | 1.00e-07 |
|=========================================================================================|
Step 4 of 4: Re-training Fast R-CNN using updated RPN.
*******************************************************************
Training a Fast R-CNN Object Detector for the following object classes:
* D10
--> Extracting region proposals from 50 training images...done.
|=========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning|
| | | (seconds) | Loss | Accuracy | Rate |
|=========================================================================================|
| 1 | 1 | 0.07 | 0.3997 | 83.33% | 1.00e-05 |
| 1 | 50 | 1.49 | 0.3756 | 75.00% | 1.00e-05 |
| 2 | 100 | 3.02 | 0.2933 | 75.00% | 1.00e-05 |
| 3 | 150 | 4.50 | 0.2921 | 75.00% | 1.00e-06 |
| 4 | 200 | 5.92 | 0.2916 | 75.00% | 1.00e-06 |
| 5 | 250 | 7.33 | 0.2916 | 75.00% | 1.00e-07 |
|=========================================================================================|
Finished training Faster R-CNN object detector.
Then I clear everything and run the same script again with everything the same:
Step 4 of 4: Re-training Fast R-CNN using updated RPN.
*******************************************************************
Training a Fast R-CNN Object Detector for the following object classes:
* D10
--> Extracting region proposals from 50 training images...done.
Error using vision.internal.cnn.fastrcnn.RegionReader (line 146)
Unable to find any region proposals to use as positive or negative training samples.
Error in vision.internal.cnn.fastrcnn.TrainingRegionDispatcher (line 63)
vision.internal.cnn.fastrcnn.RegionReader(...
Error in fastRCNNObjectDetector/createTrainingDispatcher (line 667)
dispatcher = vision.internal.cnn.fastrcnn.TrainingRegionDispatcher(...
Error in fastRCNNObjectDetector.train (line 173)
dispatcher = createTrainingDispatcher(...
Error in trainFasterRCNNObjectDetector (line 359)
[~, frcnn] = fastRCNNObjectDetector.train(trainingData, fastRCNN, options(4), params, checkpointSaver);
Error in RCNN (line 119)
rcnn = trainFasterRCNNObjectDetector(groundtruth, net, options, ...

Simon MADEC
Simon MADEC 2017-8-31
Hello,
I still have the same problem, the training works well using alexnet, I swith to VGG and have this error again. Thus, it might be a memory problem but it used really small images ...

Wajahat Nawaz
Wajahat Nawaz 2018-5-21
</matlabcentral/answers/uploaded_files/118461/Untitled.png> Dear all, I have run Faster rcnn in matlab but it stuck at second stage. can anyone facing problem like this. I have 3300 images of size 1200 x 1200. waiting for suitable answer.
  2 个评论
Wei Guo
Wei Guo 2018-5-28
I also stuck at the second stage. I use Matlab 2018a, the size of training image is 346*519 and it includes 472 training images in total.

请先登录,再进行评论。


LIU
LIU 2018-7-27
I even did not get any region proprosals! errors look like this:
*********************************************************************** Training a Faster R-CNN Object Detector for the following object classes:
  • vehicle
Step 1 of 4: Training a Region Proposal Network (RPN). Training on single CPU. ========================================================================================= | Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning| | | | (seconds) | Loss | Accuracy | Rate =========================================================================================| | 1 | 1 | 1.89 | 0.6927 | 63.14% | 0.0010 10 | 20 | 43.55 | NaN | 57.03% | 0.0010 | =========================================================================================
Step 2 of 4: Training a Fast R-CNN Network using the RPN from step 1. ***************************************************************** Training a Fast R-CNN Object Detector for the following object classes:
  • vehicle
--> Extracting region proposals from 2 training images...警告: An error occurred while using @(x)d.propose(x,minBoxSize,'MiniBatchSize',miniBatchSize) to process /usr/local/MATLAB/R2017b/toolbox/vision/visiondata/vehicles/image_00001.jpg:
需要的 第 2 个输入, score, 应为 有限。
Regions from this image will not be used for training. > In fastRCNNObjectDetector.invokeRegionProposalFcn (line 268) In fastRCNNObjectDetector>@(x,filename)fastRCNNObjectDetector.invokeRegionProposalFcn(fcnCopy,x,filename) (line 158) In fastRCNNObjectDetector.extractRegionProposals (line 218) In fastRCNNObjectDetector.train (line 168) In trainFasterRCNNObjectDetector (line 297) In testcnn2 (line 121) 警告: An error occurred while using @(x)d.propose(x,minBoxSize,'MiniBatchSize',miniBatchSize) to process /usr/local/MATLAB/R2017b/toolbox/vision/visiondata/vehicles/image_00002.jpg:
需要的 第 2 个输入, score, 应为 有限。
Regions from this image will not be used for training. > In fastRCNNObjectDetector.invokeRegionProposalFcn (line 268) In fastRCNNObjectDetector>@(x,filename)fastRCNNObjectDetector.invokeRegionProposalFcn(fcnCopy,x,filename) (line 158) In fastRCNNObjectDetector.extractRegionProposals (line 218) In fastRCNNObjectDetector.train (line 168) In trainFasterRCNNObjectDetector (line 297) In testcnn2 (line 121) done.
错误使用 vision.internal.cnn.fastrcnn.RegionReader (line 146) Unable to find any region proposals to use as positive or negative training samples.
出错 vision.internal.cnn.fastrcnn.TrainingRegionDispatcher (line 63) vision.internal.cnn.fastrcnn.RegionReader(...
出错 fastRCNNObjectDetector/createTrainingDispatcher (line 668) dispatcher = vision.internal.cnn.fastrcnn.TrainingRegionDispatcher(...
出错 fastRCNNObjectDetector.train (line 173) dispatcher = createTrainingDispatcher(...
出错 trainFasterRCNNObjectDetector (line 297) [~, fastRCNN] = fastRCNNObjectDetector.train(trainingData, fastRCNN, options(2), params, checkpointSaver);
出错 testcnn2 (line 121) detector = trainFasterRCNNObjectDetector(trainingData, layers, options, ...
what can I do???

产品

Community Treasure Hunt

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

Start Hunting!

Translated by