P. Viola と M. Jones の検出フレームワークを C++ で実装しようとしています (最初は、単にシーケンス分類子 - カスケード バージョンではありません)。最も重要な AdaBoost コア アルゴリズムにもかかわらず、必要なすべてのクラスとモジュール (たとえば、統合イメージ、Haar 機能) を設計したと思います。
私は P. Viola と M. Jones の原著論文と他の多くの出版物を読みました。残念ながら、1 つの弱分類器に最適なしきい値を見つける方法をまだ理解していませんか? 「加重中央値」および「ガウス分布」アルゴリズムと多くの数学公式への参照はわずかしか見つかりませんでした...
OpenCV Train Cascade モジュール ソースをテンプレートとして使用しようとしましたが、非常に包括的であるため、コードのリバース エンジニアリングを行うには非常に時間がかかります。また、Adaptive Boosting の考え方を理解するために、独自の簡単なコードをコーディングしました。
問題は、1 つの弱分類器の最適なしきい値を計算する最良の方法を説明してもらえますか?
以下に、Google で見つかったサンプルから書き直した AdaBoost 疑似コードを示しますが、それが正しいアプローチであるかどうかは確信が持てません。1 つの弱分類器の計算は非常に遅く (数時間)、特に最適なしきい値の計算方法に疑問があります。
(1) AdaBoost::FindNewWeakClassifier
(2) AdaBoost::CalculateFeatures
(3) AdaBoost::FindBestThreshold
(4) AdaBoost::FindFeatureError
(5) AdaBoost::NormalizeWeights
(6) AdaBoost::FindLowestError
(7) AdaBoost::ClassifyExamples
(8) AdaBoost::UpdateWeights
DESCRIPTION (1)
-Generates all possible arrangement of features in detection window and put to the vector
DO IN LOOP
-Runs main calculating function (2)
END
DESCRIPTION(2)
-Normalizes weights (5)
DO FOR EACH HAAR FEATURE
-Puts sequentially next feature from list on all integral images
-Finds the best threshold for each feature (3)
-Finds the error for each the best feature in current iteration (4)
-Saves errors for each the best feature in current iteration in array
-Saves threshold for each the best feature in current iteration in array
-Saves the threshold sign for each the best feature in current iteration in array
END LOOP
-Finds for classifier index with the lowest error selected by above loop (6)
-Gets the value of error from the best feature
-Calculates the value of the best feature in the all integral images (7)
-Updates weights (8)
-Adds new, weak classifier to vector
DESCRIPTION (3)
-Calculates an error for each feature threshold on positives integral images - seperate for "+" and "-" sign (4)
-Returns threshold and sign of the feature with the lowest error
DESCRIPTION(4)
- Returns feature error for all samples, by calculating inequality f(x) * sign < sign * threshold
DESCRIPTION (5)
-Ensures that samples weights are probability distribution
DESCRIPTION (6)
-Finds the classifier with the lowest error
DESCRIPTION (7)
-Calculates a value of the best features at all integral images
-Counts false positives number and false negatives number
DESCRIPTION (8)
-Corrects weights, depending on classification results
助けてくれてありがとう