2

こんにちは、カスケード分類器、アンドロイド、opencv ライブラリを使用して車を認識しようとしています。私の問題は、私の電話がほとんどすべてを車としてマークしていることです。

https://www.youtube.com/watch?v=WEzm7L5zoZE と顔検出サンプルに基づいてコードを作成しました 。私のアプリは、マーキングがランダムに見えるため、非常に奇妙な動作をします。車のマーキングが正しいのか、それともランダムな動作なのかさえわかりません。現時点では、私のキーボードを車としてマークしています。何を改善できるかわかりません。5段階または14段階までのトレーニングの間に進歩が見られません

ファイルを最大 14 段階までトレーニングしました

私のコードは次のようになります。

@Override
public Mat onCameraFrame(Mat aInputFrame) {
    // return FrameAnalyzer.analyzeFrame(aInputFrame);
    // Create a grayscale image
    Imgproc.cvtColor(aInputFrame, grayscaleImage, Imgproc.COLOR_RGBA2RGB);

    MatOfRect objects = new MatOfRect();

    // Use the classifier to detect faces
    if (cascadeClassifier != null) {
        cascadeClassifier.detectMultiScale(grayscaleImage, objects, 1.1, 1,
                2, new Size(absoluteObjectSize, absoluteObjectSize),
                new Size());
    }

    Rect[] dataArray = objects.toArray();
    for (int i = 0; i < dataArray.length; i++) {
        Core.rectangle(aInputFrame, dataArray[i].tl(), dataArray[i].br(),
                new Scalar(0, 255, 0, 255), 3);
    }

    return aInputFrame;
}
4

1 に答える 1

2

Try changing the below.

  1. Using COLOR_RGBA2RGB with cvtColor as in sample code will not give a gray scale image. Try RGBA2GRAY
  2. Increase the number of neighbors in detectMultiScale. Now it's 2. More neighbors means more confidence in result.
  3. Hope there are enough samples to train with. A quick search and reading through books, gives an impression like thousands of images are needed for training. For e.g. around 10000 images are used for OCR haar training. For face training, 3000 to 5000 samples are used.
  4. More importantly, decide if you really want to go with haar training for identifying a car. There could be better methods of vehicle identification. For e.g. for a moving vehicle we could use optical flow based techniques.
于 2014-12-07T18:19:45.507 に答える