如何解决Yolo提供的输出具有有价值的框置信度分数,但类置信度为零
我正在尝试使用此OpenCV tutorial检测图片中的对象。
img = cv2.imread('images/3.jpg')
# Give the configuration and weight files for the model and load the network.
net = cv2.dnn.readNetFromDarknet('yolov3/yolov3.cfg','yolov3/yolov3.weights')
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_OPENCV)
# determine the output layer
ln = net.getLayerNames()
ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()]
# construct a blob from the image
blob = cv2.dnn.blobFromImage(img,1/255.0,(416,416),swapRB=True,crop=False)
r = blob[0,:,:]
outputs = net.forward(ln)
def trackbar2(x):
confidence = x/100
r = r0.copy()
for output in np.vstack(outputs):
if output[4] > confidence:
print(output[4:])
x,y,w,h = output[:4]
p0 = int((x-w/2)*416),int((y-h/2)*416)
p1 = int((x+w/2)*416),int((y+h/2)*416)
cv.rectangle(r,p0,p1,1,1)
cv2.imshow('blob',r)
r0 = blob[0,:]
r = r0.copy()
cv2.imshow('blob',r)
cv2.createTrackbar('confidence','blob',33,101,trackbar2)
trackbar2(33)
在文章中说输出是长度为85的向量:
- 边界框的4倍(中心x,居中,宽度,高度)
- 1x盒置信度
- 80倍的课堂信心
但是,我还有其他一些结果,它们的箱子置信度得分很高,但分类置信度为零。
盒子的置信度得分是什么意思?这是正常情况吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。