1

カスケード分類器のトレーニングに問題があります。

まず、opencv_createsamples を使用してサンプルを作成します。

./opencv_createsamples -vec test.vec -img ./positive/speed_50.jpeg -bg /home/boris/src/cascade/neg.txt -num 50 -w 150 -h 150

それはうまく機能し、出力は次のとおりです。

Info file name: (NULL)
Img file name: ./positive/speed_50.jpeg
Vec file name: test.vec
BG  file name: /home/boris/src/cascade/neg.txt
Num: 50
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 1.1
Max y angle: 1.1
Max z angle: 0.5
Show samples: FALSE
Width: 150
Height: 150
Create training samples from single image applying distortions...
Done

次に、カスケード トレーナー:

./opencv_traincascade -data /home/boris/src/cascade -vec ./test.vec -bg ./neg.txt -numPos 50 -numNeg 2 -w 150 -h 150

そして、次のエラーが表示されます。

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Emergency stop (core dumped)

neg.txt ファイル:

img/img1.jpeg  
img/img2.jpeg

両方のファイルが img ディレクトリに存在します。

OpenCVのバージョンは2.4.2、OSはUbuntu 12.04です。

助けてくれてありがとう。

4

1 に答える 1

0

w と h を、生成されたサンプルと同じサイズに設定する必要があります。この場合は 150 です。サンプルサイズが大きすぎると、彼は同じ問題を抱えています。96x96 ではなく 48x48 で機能します。より大きなサンプルで問題が解決した場合はお知らせください。

よろしく

于 2012-12-30T03:23:49.950 に答える