dlib在VS2015中使用OpenFrameWorks模板
dlib Templating with openFrameworks in VS2015
我正在尝试使用OpenFrameworks内的DLIB库的深神经网络部分。到目前为止,我已经能够自己构建DLIB示例没有任何问题。我也与OpenFrameWorks合作了一段时间,并且知道它可以毫无问题地构建。
每当我尝试整合两者时,我都会在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>';
" 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示例中共享的示例与以下方式相同:
#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中填充了罚款,但是第二个块引发了我上面提到的错误。我已经能够将其缩小到以下事实,即编译器在" net_type net"的实例化中存在问题,但无法弄清楚为什么。
不确定dlib
的特定内部内容,但似乎与编译器生成的默认移动构建器(以及潜在的移动分配操作员)有问题;第一个代码块仅插入net_type
对象,它不会将其包装在类中。
尝试删除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;
};
相关文章:
- 如何在 macOS 上将 openFrameworks 构建为分片库
- 如何呈现 openFrameworks 应用程序以在浏览器上托管
- 在 openFrameworks 上设置图像的透明度
- Disparity Map Map Post Processing在OpenFrameworks中处理
- 在openFrameworks中,是否可以在使用ofxPiMapper时更改我的fbo源的不透明度
- 从OpenFrameworks OpenCV中的数组中获取凸出点
- dlib在VS2015中使用OpenFrameWorks模板
- 用图像或视频在OpenCV(OpenFrameWorks)中填充Blobs
- 我可以在OpenFrameWorks中调用应用程序以外的其他内容
- OpenFrameworks-如何进出视频
- OpenFrameWorks,带有OpenCV,VS2013设置
- 使用纹理进行基本的openframeWorks着色器编程
- 声明一个字符串数组并查找其中的元素数量(openFrameworks)
- Openframeworks-通过OpenGL调用从图像中心旋转图像
- OpenFrameworks中的透明背景窗口
- 在Raspberry Pi上运行OSX openFrameworks项目的最简单方法是什么?
- 在OpenFrameworks项目上使用Kinect SDK时出现了很多错误
- openFrameworks:如何允许两个事件键同时发生
- 监视C++OpenFrameworks应用程序是否冻结或内存泄漏,然后强制退出并重新启动
- 如何在OpenFrameworks中绘制CvConnectedComp