PaddleDetection C++版本编译部署指南

事前准备:

编译步骤:

    参照PaddleDetection文档进行,

  1. 打开Visual Studio 2019 Community,点击继续但无需代码

  2. 点击: 文件->打开->CMake

选择项目代码所在路径,并打开CMakeList.txt

  1. 点击:项目->cpp_inference_demo的CMake设置(VS需要选择安装CMAKE)

     

  1. 点击浏览,分别设置编译选项指定CUDAOpenCVPaddle预测库的路径

 

 

5.点击生成->全部生成

 

问题总结:

  1. 在生成时候时候这段会报错,是因为没有对CMAKE设置新标准
inline std::vector<std::string> get_directory_images(const std::string& path,
                                                     const std::string& exts) {
   std::vector<std::string> imgs;
   /*   for (const auto& item :
                std::experimental::filesystem::directory_iterator(path)) {
        auto suffix = item.path().extension().string();
        if (exts.find(suffix) != std::string::npos && suffix.size() > 0) {
            auto fullname = path_join(path, item.path().filename().string());
            imgs.push_back(item.path().string());
        }
    }
    sort(imgs.begin(), imgs.end());*/
    return imgs;
}

解决方法:

   打开CMakeLists.txt,在首行添加即可

set(CMAKE_CXX_STANDARD 17)

 2.报错__cudaPopCallConfiguration,建议安装cuda后重新安装VS试试

 3.报错/DWIN32 /D_WINDOWS /Wall /GR /EHsc ,这个问题我换电脑之后没有发现

 4.这段YAML会直接报错,因为路径解析的原因,我直接把模型读取的相关路径写死在代码里就没事了

if (!_model_config.load_config(conf)) {

----------------------------------------------------------------------------这里是分隔符---------------------------------------------------------------------------

编译完成后就可以 尽情愉快的玩耍啦,运行程序需要读取相应YAML路径中的配置和模型路径,官方给出了fast-rcnn和加了fpn的fast-rcnn。

如果要尝试其他模型,可以在python  ./tools/export_model.py这个文件把相应的文件导出

# 导出FasterRCNN模型,输入是3x640x640
python tools/export_model.py -c configs/faster_rcnn_r50_1x.yml \
        --output_dir=./inference_model \
        -o weights=https://paddlemodels.bj.bcebos.com/object_detection/faster_rcnn_r50_1x.tar \
           TestReader.inputs_def.image_shape=[3,640,640]

# 导出YOLOv3模型,输入是3x320x320
python tools/export_model.py -c configs/yolov3_darknet.yml \
        --output_dir=./inference_model \
        -o weights=https://paddlemodels.bj.bcebos.com/object_detection/yolov3_darknet.tar \
           TestReader.inputs_def.image_shape=[3,320,320]

# 导出SSD模型,输入是3x300x300
python tools/export_model.py -c configs/ssd/ssd_mobilenet_v1_voc.yml \
        --output_dir=./inference_model \
        -o weights= https://paddlemodels.bj.bcebos.com/object_detection/ssd_mobilenet_v1_voc.tar \
           TestReader.inputs_def.image_shape=[3,300,300]

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值