'Can getUnconnectedOutLayers() get the variable Width and Height?
I wanted to use this way to do the object detection but somehow the Python can`t detect my width and height, it always show me that variables_undefined errors, but based on others I don't saw this problems appear to them, may I ask what is the problem in my codes?
ln=yolo.getLayerNames()
ln=[ln[i[0]-1] for i in yolo.getUnconnectedOutLayers()] layerOut=yolo.forward(ln)
boxs=[]
confidences=[]
classIds = []
for outputs in layerOut:
for detection in outputs:
score = detection[5:]
classId=np.argMax(score)
confidence=score[classId]
if confidence>0.7:
centerX=int(detection[0]*width)
centerY=int(detection[0]*height)
w=int(detection[0]*width)
h=int(detection[0]*height)
x=int(centerX-w/2)
y=int(centerY-w/2)
boxs.append([x,y,w,h])
confidences.append(float(confidence))
classIds.append(classId)
I have tried to defined the variables but it seems if I define it the ouptput is incorrect.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
