franzhong 2020-07-29 15:59 采纳率: 100%
浏览 229
已采纳

QT opencv darknet异常

图片说明

debug到载入网格的时候就异常退出了,该怎么知道错误原因呢?加try catch也没输出任何东西。QT中你们都是这样调试的吗?只能找到某一行,不知道具体出错原因?

【说明】:

(1)代码没有问题,相同代码在VS2019下运行正常。

(2)环境没有问题,相同环境,且QT正常配置了参数,编译前无语法错误,在dnn.hpp中有三个函数,见尾部引用。。。

(3)关于路径:三个训练文件都放在了,工程的build-MeDetection-Desktop_x86_windows_msvc2019_pe_64bit-Debug 文件夹下了,出错代码的上方代码为:

    std::string classesFile = "me.names";
    std::ifstream classNamesFile(classesFile.c_str());
    if (classNamesFile.is_open())
    {
        std::string className = "";
        while (std::getline(classNamesFile, className))
            classes.push_back(className);
    }
    else {
        std::cout << "can not open classNamesFile" << std::endl;
    }

上面的代码并没有输出“can not open classNamesFile”,说明me.names的路径是正确的,同理,另两个文件的路径应该也没有问题,但是cv::dnn::readNetFromDarknet(modelConfiguration, modelWeights)这句就是通过不了,还不能提示具体的原因怎么办???

-----------------------------谢谢

引用

/** @brief Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
    *  @param cfgFile      path to the .cfg file with text description of the network architecture.
    *  @param darknetModel path to the .weights file with learned network.
    *  @returns Network object that ready to do forward, throw an exception in failure cases.//没看到,不清楚failure细节被扔哪去了>.<~!
    *  @returns Net object.
    */
    CV_EXPORTS_W Net readNetFromDarknet(const String &cfgFile, const String &darknetModel = String());

    /** @brief Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
     *  @param bufferCfg   A buffer contains a content of .cfg file with text description of the network architecture.
     *  @param bufferModel A buffer contains a content of .weights file with learned network.
     *  @returns Net object.
     */
    CV_EXPORTS_W Net readNetFromDarknet(const std::vector<uchar>& bufferCfg,
                                        const std::vector<uchar>& bufferModel = std::vector<uchar>());

    /** @brief Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
     *  @param bufferCfg   A buffer contains a content of .cfg file with text description of the network architecture.
     *  @param lenCfg      Number of bytes to read from bufferCfg
     *  @param bufferModel A buffer contains a content of .weights file with learned network.
     *  @param lenModel    Number of bytes to read from bufferModel
     *  @returns Net object.
     */
    CV_EXPORTS Net readNetFromDarknet(const char *bufferCfg, size_t lenCfg,
                                      const char *bufferModel = NULL, size_t lenModel = 0);
  • 写回答

1条回答 默认 最新

  • threenewbee 2020-07-29 16:56
    关注

    这种引用静态库的程序,需要严格匹配c++编译器的版本,否则就会各种报错,尽管可以编译。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 Matlab打开默认名称带有/的光谱数据
  • ¥50 easyExcel模板 动态单元格合并列
  • ¥15 res.rows如何取值使用
  • ¥15 在odoo17开发环境中,怎么实现库存管理系统,或独立模块设计与AGV小车对接?开发方面应如何设计和开发?请详细解释MES或WMS在与AGV小车对接时需完成的设计和开发
  • ¥15 CSP算法实现EEG特征提取,哪一步错了?
  • ¥15 游戏盾如何溯源服务器真实ip?需要30个字。后面的字是凑数的
  • ¥15 vue3前端取消收藏的不会引用collectId
  • ¥15 delphi7 HMAC_SHA256方式加密
  • ¥15 关于#qt#的问题:我想实现qcustomplot完成坐标轴
  • ¥15 下列c语言代码为何输出了多余的空格