Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有关前向推断的问题 #46

Closed
beizhengren opened this issue Aug 12, 2020 · 3 comments
Closed

有关前向推断的问题 #46

beizhengren opened this issue Aug 12, 2020 · 3 comments

Comments

@beizhengren
Copy link
Contributor

作者您好,

1.在创建engine的过程

我看您是把所有层都解析完成之后, 才判断是否有已经产生好的engine. 可不可以把这个判断放在最前面?

if (fileExists(m_EnginePath))

2.关于前向推断

我想直接读取保存好的engine 然后进行推断. 也就是直接

detector_->detect(mat_temp, res);

而不进行初始化去创建engine

detector_->init(config_v4_tiny);

但是这样做是有错的

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

请问这里我应该如何实现比较好?

感谢!

@enazoe
Copy link
Owner

enazoe commented Aug 12, 2020

1.可以放到最前面
2.程序会根据你的模型自动去找对应的engine,如果没有才会生成engin,有的话会直接加载。再就是engin文件是和平台绑定的并不是所有平台通用的

@beizhengren
Copy link
Contributor Author

@enazoe
作者您好, 我放到了

trtWeights.push_back(divWeights);

的后面, 即:

    trtWeights.push_back(divWeights);

    if (fileExists(m_EnginePath))
    {
        std::cout << "Using previously generated plan file located at " << m_EnginePath
                  << std::endl;
        destroyNetworkUtils(trtWeights);
        return;
    }

会报以下错误:

ERROR: yolo-trt: ~/yolo-tensorrt/modules/yolo.cpp:578: 
void Yolo::allocateBuffers(): Assertion `(tensor.bindingIndex != -1) && "Invalid output binding index"' failed.

@beizhengren
Copy link
Contributor Author

@enazoe
作者您好,我找到原因了,是因为对输出的内存分配和确认问题导致的.
现在解决了,谢谢~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants