ドキュメンテーションの中の「Faster R-CNN 深層学習を使用したオ​ブジェクトの検出」に​示されたプログラムの​実行中に発生するエラ​ーについて

標記のプログラムおいて、ネットワークをこのプログラムの中で学習させるために、変数 doTrainingAndEval を true に設定して実行させたとき、
% Annotate detections in the image.
I = insertObjectAnnotation(I, 'rectangle', bboxes, scores);
のステップが終了した段階で、以下のような表示が出力されます。
******************************
Faster R-CNN オブジェクト検出器の学習が終了しました。
エラー: insertObjectAnnotation
LABELは空以外にする必要があります。
エラー: insertObjectAnnotation
エラー: insertObjectAnnotation
エラー: insertObjectAnnotation
エラー: fasterRCNNtrue (line 〇〇〇)
I = insertObjectAnnotation(I, 'rectangle', bboxes, scores);
******************************
このようなエラーが生じないようにする対応についてお教え下さい。

Respuestas (1)

Tohru Kikawada
Tohru Kikawada el 3 de Sept. de 2018

2 votos

こちら の例を実行された際のエラーと仮定してお答えいたします。
ご提示のエラーは変数 socres が空になっているため発生しているようです。
下記のとおり、上流のコードで detect メソッドを使って車両を検出していますが、検出が正しくできていないようです。Faster R-CNNの学習モデル( detector )が正しく生成されているかご確認ください。
% Run the detector.
[bboxes, scores] = detect(detector, I);

9 comentarios

Ryousuke Imanishi
Ryousuke Imanishi el 3 de Sept. de 2018
ご回答をいただき有難うございます。 質問内容が不明確で申し訳ありません。質問の趣旨は、次の様です。 ご指摘の【こちら】のドキュメントに示されたプログラムをそのままコピーして実行させました結果、doTrainingAndEvalをfalseにした場合は、ドキュメントの内容通りの結果になりましたが、trueにした場合は、先に示しましたようなエラーが生じました。お伺いしたく存じますポイントは、ドキュメントに示されたプログラムに何か変更を加える必要があるのか否かということでございます。 当方は、初学者でありますので、完全なプログラムを参考に具体的な事例を勉強したいと考えております。宜しくお願い致します。
Tohru Kikawada
Tohru Kikawada el 4 de Sept. de 2018
trainFasterRCNNObjectDetector の部分で下記のように学習の進捗は表示されていますか。また、お使いのMATLABのバージョンやToolboxの構成はどうなっていますでしょうか。
*************************************************************************
次のオブジェクト クラスに対する Faster R-CNN オブジェクト検出器の学習:
* vehicle
手順 1/4: 領域提案ネットワーク (RPN) の学習。
単一の CPU で学習中。
|========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning |
| | | (hh:mm:ss) | Accuracy | RMSE | Rate |
|========================================================================================|
| 1 | 1 | 00:00:01 | 39.06% | 1.01 | 0.0010 |
| 1 | 50 | 00:00:35 | 58.98% | 1.06 | 0.0010 |
| 1 | 100 | 00:01:05 | 42.97% | 1.12 | 0.0010 |
| 1 | 150 | 00:01:34 | 94.92% | 0.80 | 0.0010 |
| 2 | 200 | 00:02:09 | 45.70% | 1.20 | 0.0010 |
| 2 | 250 | 00:02:43 | 75.78% | 1.18 | 0.0010 |
| 2 | 300 | 00:03:17 | 49.22% | 0.86 | 0.0010 |
| 2 | 350 | 00:03:47 | 92.97% | 0.82 | 0.0010 |
Ryousuke Imanishi
Ryousuke Imanishi el 4 de Sept. de 2018
Editada: michio el 4 de Sept. de 2018
更なるご検討を有難うございます。ご質問のシステムの構成、及びプログラム実行時の出力内容を以下に示すます。
【システム構成】 MATLAB R2018a
{'Computer Vision System Toolbox' }
{'Financial Toolbox' }
{'Image Acquisition Toolbox' }
{'Image Processing Toolbox' }
{'Neural Network Toolbox' }
{'Parallel Computing Toolbox' }
{'Signal Processing Toolbox' }
{'Statistics and Machine Learning Toolbox'}
【出力内容】
*************************************************************************
次のオブジェクト クラスに対する Faster R-CNN オブジェクト検出器の学習:
* vehicle
手順 1/4: 領域提案ネットワーク (RPN) の学習。
単一の GPU で学習中。
|================================================================================
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning |
| | | (hh:mm:ss) | Accuracy | RMSE | Rate |
|================================================================================
| 1 | 1 | 00:00:17 | 41.41% | 1.00 | 1.0000e-05 |
| 1 | 50 | 00:00:21 | 53.13% | 1.07 | 1.0000e-05 |
   (途中省略)
| 10 | 1750 | 00:02:19 | 92.97% | 0.96 | 1.0000e-05 |
| 10 | 1770 | 00:02:21 | 45.67% | 1.01 | 1.0000e-05 |
|================================================================================
手順 2/4: 手順 1 RPN を使用した Fast R-CNN ネットワークの学習。
*******************************************************************
次のオブジェクト クラスに対する Fast R-CNN オブジェクト検出器の学習:
* vehicle
--> 177 個の学習イメージから領域提案を抽出中...完了。
単一の GPU で学習中。
|================================================================================
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning |
| | | (hh:mm:ss) | Accuracy | RMSE | Rate |
|================================================================================
| 1 | 1 | 00:00:02 | 48.44% | 1.07 | 1.0000e-05 |
| 1 | 50 | 00:00:04 | 96.09% | 1.10 | 1.0000e-05 |
   (途中省略)
| 10 | 1650 | 00:01:01 | 89.06% | 1.02 | 1.0000e-05 |
| 10 | 1680 | 00:01:02 | 99.22% | 1.16 | 1.0000e-05 |
|================================================================================
手順 3/4: 重みを Fast R-CNN と共有で使用した RPN の再学習。
単一の GPU で学習中。
|================================================================================
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning |
| | | (hh:mm:ss) | Accuracy | RMSE | Rate |
|================================================================================
| 1 | 1 | 00:00:00 | 50.78% | 1.07 | 1.0000e-06 |
| 1 | 50 | 00:00:03 | 42.97% | 1.21 | 1.0000e-06 |
   (途中省略)
| 10 | 1750 | 00:01:54 | 79.69% | 1.03 | 1.0000e-06 |
| 10 | 1770 | 00:01:56 | 60.94% | 1.13 | 1.0000e-06 |
|================================================================================
手順 4/4: 更新された RPN を使用した Fast R-CNN の再学習。
*******************************************************************
次のオブジェクト クラスに対する Fast R-CNN オブジェクト検出器の学習:
* vehicle
--> 177 個の学習イメージから領域提案を抽出中...完了。
単一の GPU で学習中。
|================================================================================
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning |
| | | (hh:mm:ss) | Accuracy | RMSE | Rate |
|================================================================================
| 1 | 1 | 00:00:00 | 93.75% | 0.85 | 1.0000e-06 |
| 1 | 50 | 00:00:01 | 95.31% | 1.08 | 1.0000e-06 |
   (途中省略)
| 10 | 1500 | 00:00:44 | 98.44% | 0.83 | 1.0000e-06 |
| 10 | 1550 | 00:00:46 | 94.53% | 1.04 | 1.0000e-06 |
|================================================================================
Faster R-CNN オブジェクト検出器の学習が終了しました。
エラー: insertObjectAnnotation
LABELは空以外にする必要があります。
エラー: insertObjectAnnotation
エラー: insertObjectAnnotation
エラー: insertObjectAnnotation
エラー: fasterRCNNtrue (line 131)
I = insertObjectAnnotation(I, 'rectangle', bboxes, scores);
以上
Tohru Kikawada
Tohru Kikawada el 5 de Sept. de 2018
ありがとうございます。手順やToolboxの構成に問題はなさそうです。
エラーが出た際の bboxes socres の内容はどうなっていますでしょうか。
>> bboxes
>> scores
Ryousuke Imanishi
Ryousuke Imanishi el 5 de Sept. de 2018
Editada: michio el 5 de Sept. de 2018
ご回答有難うございます。 ご質問のbboxes 及びscores の出力結果は次の様です。
**********************
bboxes =
0×4 の空の double 行列
scores =
0×1 の空の single 列ベクトル
**********************
宜しくお願い致します。
Tohru Kikawada
Tohru Kikawada el 6 de Sept. de 2018
detector が指定した画像から車両を検出できていないようですね。学習するGPUデバイスによって学習結果が変わってくることがあり得るため、複数の画像に対して下記のテストをお試しいただけますか。 どの画像に対しても何も検出されないということですと、画像の型(uint8/single/double)など他の部分に問題がありそうです。
% To quickly verify the training, run the detector on a test image.
images = cell(10,1);
for k = 1:10
% Read a test image.
I = imread(testData.imageFilename{k});
% Run the detector.
[bboxes,scores] = detect(detector,I);
% Annotate detections in the image.
if isempty(scores)
images{k} = I;
else
images{k} = insertObjectAnnotation(I,'rectangle',bboxes,scores);
end
end
figure, montage(images)
Ryousuke Imanishi
Ryousuke Imanishi el 6 de Sept. de 2018
ご回答有難うございます。提供されたプログラム部分を下記のように挿入して走らせましたところ、すべての画像において検出さず、元の自動車の画像のみが表示されます。宜しくお願い致します。
%*********************************************** doTrainingAndEval = true;
if doTrainingAndEval % Set random seed to ensure example training reproducibility. rng(0);
% Train Faster R-CNN detector. Select a BoxPyramidScale of 1.2 to allow
% for finer resolution for multiscale object detection.
detector = trainFasterRCNNObjectDetector(trainingData, layers, options, ...
'NegativeOverlapRange', [0 0.3], ...
'PositiveOverlapRange', [0.6 1], ...
'BoxPyramidScale', 1.2);
else
% Load pretrained detector for the example.
detector = data.detector;
end
%
%**************************************************
% To quickly verify the training, run the detector on a test image.
%
images = cell(10,1);
for k = 1:10
% Read a test image.
I = imread(testData.imageFilename{k});
% Run the detector.
[bboxes,scores] = detect(detector,I);
% Annotate detections in the image.
if isempty(scores)
images{k} = I;
else
images{k} = insertObjectAnnotation(I,'rectangle',bboxes,scores);
end
end
figure, montage(images)
%
%**************************************************
Tohru Kikawada
Tohru Kikawada el 7 de Sept. de 2018
ご連絡ありがとうございます。実行環境に差異に依存するなんらかの不具合の可能性がございます。
もし保守サービス有効なアカデミックライセンスまたはコマーシャルライセンスをご使用中でしたら、弊社技術サポート窓口(下記)のご利用もどうぞご検討ください。
お手数ですがよろしくお願いいたします。
Ryousuke Imanishi
Ryousuke Imanishi el 7 de Sept. de 2018
種々ご検討していただき、有難うございました。ご提案に従って、技術サポート窓口を利用させていただきます。個人使用のため新たな費用発生に対応できないこと懸念しておりましたが、その必要が無いようですので、利用させていただきます。

Iniciar sesión para comentar.

Preguntada:

el 2 de Sept. de 2018

Comentada:

el 7 de Sept. de 2018

Community Treasure Hunt

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

Start Hunting!