10

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);
查看全部
franzhong
franzhong
2020/07/29 15:59
  • c++
  • 机器学习
  • 深度学习
  • 神经网络
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复