如何解决与dnn一起使用的开放式简历库错误?

时间:2019-08-14 05:44:20

标签: python opencv machine-learning yolo

我正在使用OpenCV dnn加载YOLO v3权重并进行预测

错误来自此行

    outs = self.net.forward(self.get_outputs_names(self.net))

enter image description here

这是整个错误

推断和预测代码

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)

什么原因导致此错误?

0 个答案:

没有答案