OpenCvSharp inputs[0].size[1] % blobs[0].size[1] == 0
报错代码如图
详细错误
未处理 OpenCvSharp.OpenCVException
HResult=-2146233088
Message=inputs[0].size[1] % blobs[0].size[1] == 0
Source=OpenCvSharp
ErrMsg=inputs[0].size[1] % blobs[0].size[1] == 0
FileName=c:\libs\opencv\4.0.0\sources\modules\dnn\src\layers\convolution_layer.cpp
FuncName=cv::dnn::ConvolutionLayerImpl::forward
Line=1114
StackTrace:
在 OpenCvSharp.NativeMethods.<>c.<.cctor>b__1619_0(ErrorCode status, String funcName, String errMsg, String fileName, Int32 line, IntPtr userdata)
在 OpenCvSharp.NativeMethods.dnn_Net_forward3(IntPtr net, IntPtr[] outputBlobs, Int32 outputBlobsLength, String[] outBlobNames, Int32 outBlobNamesLength)
在 OpenCvSharp.Dnn.Net.Forward(IEnumerable`1 outputBlobs, IEnumerable`1 outBlobNames)
解决办法
增加一句代码
Cv2.CvtColor(org, org, ColorConversionCodes.RGBA2RGB);//mat转三通道mat