/// <summary>
/// 结果处理
/// </summary>
/// <param name="result">模型预测输出</param>
/// <returns>模型识别结果</returns>
public Result process_result(float[] result)
{
Mat result_data = new Mat(56, 8400, MatType.CV_32F, result);
------> result_data = result_data.T();
// 存放结果list
List<Rect> position_boxes = new List<Rect>();
List<float> confidences = new List<float>();
List<PoseData> pose_datas = new List<PoseData>();
...
异常信息:
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
at OpenCvSharp.Internal.NativeMethods.core_MatExpr_toMat(IntPtr, IntPtr)
--------------------------------
at OpenCvSharp.MatExpr.ToMat()
at ResultSharp.PoseResult.process_result(Single[])
at ModelDeployPlatform.FormModelDeployPlat.btn_model_deploy_Click(System.Object, System.EventArgs)
at System.Windows.Forms.Control.OnClick(System.EventArgs)
at System.Windows.Forms.Button.OnClick(System.EventArgs)
at System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs)
at System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.ButtonBase.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Button.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.NativeWindow.Callback(IntPtr, WM, IntPtr, IntPtr)
at Interop+User32.DispatchMessageW(MSG ByRef)
at Interop+User32.DispatchMessageW(MSG ByRef)
at System.Windows.Forms.Application+ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(UIntPtr, msoloop, Void*)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(msoloop, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(msoloop, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Application.Run(System.Windows.Forms.Form)
at ModelDeployPlatform.Program.Main()
推理设备:ONNX runtime 推理模型:Yolov8-pose 异常代码:
异常信息:
似乎是CV的问题?我尝试了克隆新的Mat并将旧的dispose掉(当次的或上次的都试过),或者使用单独的一个对象而不使用转置后的对象替换转置前的对象都依旧会出现这个异常。
我想请教一下大佬,result传进来的长度只有50400,和这个8400*56的矩阵是个什么关系,只有前6行有数据后面50行全是0吗?如果我希望不使用CV,自己通过二维数组实现,数据该怎么填充?
谢谢大佬