Converting pixelformats for cv2 and blob

I am doing some machine learning algorithms on a video. My problem is that I get this cv2. error

cv2.error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:1114: error: (-215:Assertion failed) inputs[0].size[1] % blobs[0].size[1] == 0 in function ‘cv::dnn::ConvolutionLayerImpl::forward’

has anybody an idea what this could be?
Thanks in advance


basically it’s saying the first layer needs a specific size input and you give it something else.

Ah ok. Sry I’m quite new to cv2. Thank you already. Could I share my code here and we watch it together?

net = cv2.dnn.readNet("yolov3.weights","yolov3.cfg")

layer_names = net.getLayerNames()
output_layers = [layer_names[i[0]-1] for i in net.getUnconnectedOutLayers()]

img = op('null1').numpyArray(delayed=True)

gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)
gray = (gray *255).astype(np.uint8)

blob = cv2.dnn.blobFromImage(img,1/255,(416,416),(0,0,0),swapRB=True,crop=False)


out = net.forward(output_layers)#!!! HERE OCCURS MY ERROR