PaddlePaddle / FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
https://www.paddlepaddle.org.cn/fastdeploy
Apache License 2.0
3k stars 465 forks source link

Csharp 推理异常闪退 #2518

Open hjm950118 opened 2 months ago

hjm950118 commented 2 months ago

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 commented 1 month ago

使用C++或Python正常么