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

yolov8 c++部署 cpu结果正确 cuda结果完全不正确 #2428

Closed
ghost opened this issue Jun 14, 2023 · 4 comments
Closed

yolov8 c++部署 cpu结果正确 cuda结果完全不正确 #2428

ghost opened this issue Jun 14, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Jun 14, 2023

平台(如果交叉编译请再附上交叉编译目标平台):

Platform(Include target platform as well if cross-compiling):

CUDA

Github版本:

Github Version:

mnn tag 2.5.1

编译方式:

Compiling Method

cuda编译

问题

推理yolov8模型,转换模型没有出错,推理cpu结果正确,gpu结果完全不对。
yolov8.zip

@jxt1234 jxt1234 added the bug Something isn't working label Jun 16, 2023
@bitxsw93 bitxsw93 self-assigned this Jun 30, 2023
@bitxsw93
Copy link
Collaborator

bitxsw93 commented Jul 3, 2023

帖一下对应可以复现的测试方法?

@ghost
Copy link
Author

ghost commented Jul 7, 2023

帖一下对应可以复现的测试方法?

直接调用的对应的c++接口,像下面这样

MNN::Tensor* input_tensor = net_->getSessionInput(session_, name.c_str());

std::vector<int> input_shape = input_tensor->shape();

int input_len = 1;

for (size_t i = 0; i < input_shape.size(); i++) {

  input_len *= input_shape[i];
}

if (input.layout() == cv::MatLayout::NCHW) {

  std::lock_guard<std::mutex> lk(mtx_);

  MNN::Tensor* nchw_tensor = MNN::Tensor::create(

      input_shape, halide_type_of<float>(), input.data(), MNN::Tensor::CAFFE);

  input_tensor->copyFromHostTensor(nchw_tensor);

  MNN::Tensor::destroy(nchw_tensor);

} else {

  return com::FAIL;

}

@bitxsw93
Copy link
Collaborator

加一下MNN官方钉钉群,群里@恬步,私聊给你看下。

@bitxsw93
Copy link
Collaborator

bitxsw93 commented Aug 3, 2023

已经修复,待同步代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants