我使用opencvdnn加载yolov3权重并进行预测
这条线出错了
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)
是什么导致了这个错误?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐