我正在使用OpenCV dnn加载YOLO v3权重并进行预测
错误来自此行
outs = self.net.forward(self.get_outputs_names(self.net))
这是整个错误
推断和预测代码
def get_outputs_names(self, net):
layersNames = self.net.getLayerNames()
return [layersNames[i[0] - 1] for i in net.getUnconnectedOutLayers()]
def predict(self, image):
blob = cv.dnn.blobFromImage(image, 1/255.0, (inpWidth, inpHeight), [0,0,0], 1, crop=False)
self.net.setInput(blob)
outs = self.net.forward(self.get_outputs_names(self.net))
return outs
def infer_image(self, image):
image = cv.cvtColor(image, cv.COLOR_BGR2RGB)
outs = self.predict(image)
return self.postprocess(image, outs)
什么原因导致此错误?