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

Csharp 推理异常闪退 #2518

Open
hjm950118 opened this issue Sep 3, 2024 · 1 comment
Open

Csharp 推理异常闪退 #2518

hjm950118 opened this issue Sep 3, 2024 · 1 comment
Assignees

Comments

@hjm950118
Copy link

C# Release代码

opencv4.8版本
opencvsharp4.7 指定版本
cuda 12.1版本

运行时使用Cpu进行推理
RuntimeOption runtimeoption = new RuntimeOption();
runtimeoption.UseCpu();
fastdeploy.vision.detection.PPYOLOE model = new fastdeploy.vision.detection.PPYOLOE(model_file, params_file, config_file, runtimeoption, ModelFormat.PADDLE);
if (!model.Initialized())
{
Console.WriteLine("Failed to initialize.\n");
}
Mat image = Cv2.ImRead(image_path);
fastdeploy.vision.DetectionResult res = model.Predict(image);
Console.WriteLine(res.ToString());
Mat res_img = fastdeploy.vision.Visualize.VisDetection(image, res, 0, 1, 0.5f);
Cv2.ImShow("result.png", res_img);
Cv2.WaitKey(0);

正常加载读取模型
运行到Predict推理,就异常闪退。调试后DetectionResult detection_result =ConvertResult.ConvertCResultToDetectionResult(fd_detection_result); 问题,可以检测到目标300个,然后在return后直接异常报错,包括下方的Visualize.VisDetection(image, res, 0, 1, 0.5f);中涉及到的反转换也都是异常,最后运行完结果
image

C#的exe程序不使用兼容模式的话应该直接到predict就闪退了,使用兼容模式能到最后结果显示,但是程序中的错误肯定还是如上面描述一样存在的,该如何处理

@Jiang-Jia-Jun
Copy link
Collaborator

使用C++或Python正常么

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

3 participants