2016-07-22 14 views
1

フォローアップ:私は3つのレベルにDLIBの正面顔検出器の5つのレベルのカスケードを分割しようとしていますopenface/issue/157dlib正面検出器のカスケードレベルを分割する方法は?

を(フロント、フロントを見たが、左回転させ、フロントが見てますが回転右1)

Evgeniy検出器をC++で分割することを提案しました。私はC++に精通していません。 frontal_face_detector.hを見ると、get_serialized_frontal_facesはbase64でエンコードされたオブジェクトを返します。

私は.svmファイルに既存の検出器を保存する方法を学びました:

#include <dlib/image_processing/frontal_face_detector.h> 
#include <iostream> 

using namespace dlib; 
using namespace std; 

int main() 
{ 
    frontal_face_detector detector = get_frontal_face_detector(); 

    dlib::serialize("new_detector.svm") << detector; 

    std::cout<<"End of the Program"<<endl; 
    return 0; 
} 

それでは、どのカスケードを分割し、.svmファイルに新しい検出器を保存するには?

ピラミッドレベルを< 6>より小さくして、検出器のパフォーマンスを向上させるかどうかは、frontal_face_detector.h

答えて

5

ちょうどobject detector documentationを読んで、あなたは説明があります。 があるため、あまり役に立たないであろう任意の他の値に< 6からピラミッドレベル>を変更する、

#include <dlib/image_processing/frontal_face_detector.h> 
#include <iostream> 
#include <string> 

using namespace dlib; 
using namespace std; 

int main() 
{ 
    frontal_face_detector detector = get_frontal_face_detector(); 

    dlib::serialize("current.svm") << detector; 

    std::vector<frontal_face_detector> parts; 
    // Split into parts and serialize to disk 
    for (unsigned long i = 0; i < detector.num_detectors(); ++i) 
    { 
     dlib::frontal_face_detector part(detector.get_scanner(), detector.get_overlap_tester(), detector.get_w(i)); 
     dlib::serialize("part" + std::to_string(i) + ".svm") << part; 
     parts.push_back(part); 
    } 

    // Reconstruct original detector 
    frontal_face_detector reconstructed(parts); 
    dlib::serialize("reconstructed.svm") << reconstructed; 

    // Create detector that will work only on one level of pyramid 
    typedef dlib::scan_fhog_pyramid<dlib::pyramid_down<6> > image_scanner_type; 
    image_scanner_type scanner; 
    scanner.copy_configuration(detector.get_scanner()); 
    scanner.set_max_pyramid_levels(1); //try setting to 2, 3... 
    frontal_face_detector one_level_detector = dlib::object_detector<image_scanner_type>(scanner, detector.get_overlap_tester(), detector.get_w()); 

    std::cout<<"End of the Program"<<endl; 
    return 0; 
} 

およびNO:ここ は、部分に検出器を分割元の再構成およびピラミッドレベルを制限するコードでありますないピラミッドレベルの限界が、ピラミッドにおけるスケールのその割合:

6 = 5/6

5 = 4/5

...

+0

ありがとうございます。それはうまくいった。私が間違っているなら、私を修正し : 1.この[コメント]によると(https://github.com/davisking/dlib/blob/master/dlib/image_processing/frontal_face_detector.h#L29)、パート - 0は、フロントです探している、パート2は見えている、パート3は見ている、そうそうである。 2.左に見て右に見たいだけなら、パート1とパート2を部品ベクトルに押し戻して再構築する必要があります。 –

+0

また、デフォルト正面顔検出器のmax_pyramid_levelsとは何ですか? //:私にとってset_max_pyramid_levelsは(8)[小顔](https://github.com/cmusatyalab/openface/blob/master/images/examples/clapton-2.jpg)と比較的[大きな顔](httpsのために働きましたgithub.com/cmusatyalab/openface/blob/master/images/examples/lennon-2.jpg)。 –

+0

@vijayenthiransubramaniam、私が覚えているように、それは無制限(1000程度) – Evgeniy

関連する問題