2017-09-18 4 views
0

私はopenFrameworksの中でdlibライブラリのディープニューラルネットワーク部分を使用しようとしています。これまでは、問題なくdlibの例を自分で構築することができました。また、私はopenFrameworksをしばらく使用しており、問題なくビルドできることを知っています。dlib VS2015のopenFrameworksでのテンプレート

私は2つはしかし、私は、Visual Studio 2015でコンパイルの問題を取得統合しようとするたびに、次のように

dlib::add_loss_layer<dlib::loss_mmod_,dlib::add_layer<dlib::con_<1,9,9,1,1,4,4,SUBNET,void>>::add_loss_layer(T &&...)': could not deduce template argument for '<unnamed-symbol&gt';

dnn_mmod_face_detection_ex.cpp」に与えられた例では、ニューラルネットワークを構築します。

#include <iostream> 
#include <dlib/dnn.h> 
#include <dlib/data_io.h> 
#include <dlib/image_processing.h> 
#include <dlib/gui_widgets.h> 


using namespace std; 
using namespace dlib; 

template <long num_filters, typename SUBNET> using con5d = con<num_filters,5,5,2,2,SUBNET>; 
template <long num_filters, typename SUBNET> using con5 = con<num_filters,5,5,1,1,SUBNET>; 

template <typename SUBNET> using downsampler = relu<affine<con5d<32, relu<affine<con5d<32, relu<affine<con5d<16,SUBNET>>>>>>>>>; 
template <typename SUBNET> using rcon5 = relu<affine<con5<45,SUBNET>>>; 

using net_type = loss_mmod<con<1,9,9,1,1,rcon5<rcon5<rcon5<downsampler<input_rgb_image_pyramid<pyramid_down<6>>>>>>>>; 

int main(int argc, char** argv) try 
{ 
    if (argc == 1) 
    { 
     cout << "Call this program like this:" << endl; 
     cout << "./dnn_mmod_face_detection_ex mmod_human_face_detector.dat faces/*.jpg" << endl; 
     cout << "\nYou can get the mmod_human_face_detector.dat file from:\n"; 
     cout << "http://dlib.net/files/mmod_human_face_detector.dat.bz2" << endl; 
     return 0; 
    } 


    net_type net; 
} 
catch(std::exception& e) 
{ 
    cout << e.what() << endl; 
} 

openFrameworks exampleで共有される例は、次のように同じです:

#include "ofMain.h" 
#include <dlib/dnn.h> 
#include <dlib/data_io.h> 
#include <dlib/image_processing.h> 
using namespace dlib; 

template <long num_filters, typename SUBNET> using con5d = con<num_filters, 5, 5, 2, 2, SUBNET>; 
template <long num_filters, typename SUBNET> using con5 = con<num_filters, 5, 5, 1, 1, SUBNET>; 

template <typename SUBNET> using downsampler = relu<affine<con5d<32, relu<affine<con5d<32, relu<affine<con5d<16, SUBNET>>>>>>>>>; 
template <typename SUBNET> using rcon5 = relu<affine<con5<45, SUBNET>>>; 

using net_type = loss_mmod<con<1, 9, 9, 1, 1, rcon5<rcon5<rcon5<downsampler<input_rgb_image_pyramid<pyramid_down<6>>>>>>>>; 

class ofApp : public ofBaseApp 
{ 
public: 
    void setup() override; 
    void draw() override; 

    net_type net; 
}; 

最初のコードブロックはVS2015で正常にコンパイルされますが、2番目のコードは上記のエラーをスローします。私はコンパイラが "net_type net"のインスタンス化に問題があるが、なぜそれを理解することができなかったかという事実を絞り込むことができました。

答えて

0

dlibという特定の内部構造についてはわかりませんが、コンパイラによって生成されるデフォルトの移動コンストラクタ(および移動割り当て演算子)に問題があるようです。最初のコードブロックはnet_typeオブジェクトをinstanciatesだけ、クラスでラップしません。

ofAppクラスの移動、コンストラクタを削除してみてください、それが助けかどうかを確認:

class ofApp : public ofBaseApp 
{ 
public: 
    ofApp() = default; 
    ~ofApp() = default; 

    ofApp(ofApp&&) = delete; 
    ofApp& operator=(ofApp&&) = delete; 

    void setup() override; 
    void draw() override; 

    net_type net; 
}; 
+0

はこれを試してみました。 「適切なデフォルトコンストラクターがありません」というエラーが発生します。 – wildparadox

+0

これはちょっと変です。コードスニペットでは、実際にオブジェクトを構築していないからです。決して少なくても、デフォルトコンストラクタを追加することができます。改訂スニペットを参照してください。 – Chris

関連する問題