0
def findGun(outputs,img):
ht , wt , ct = img.shape
bbox = []
classIDs = []
confs = []
for output in outputs:
    for det in outputs:
        scores = det[5:]
        classID = np.argmax(scores)
        confidence = scores[classID]
        if confidence > confThreshold:
            w,h = int(det[2]*wt),int(det[3]*ht)
            x , y = int((det[0]*wt) - w/2),int((det[1]*ht) - h/2)
            bbox.append([x,y,w,h])
            classIDs.append(classID)
            confs.append(float(confidence))

Traceback (most recent call last): File "yolo.py", line 46, in findGun(outputs,img) File "yolo.py", line 26, in findGun if confidence > confThreshold: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

  • 3
    Does this answer your question? [ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()](https://stackoverflow.com/questions/10062954/valueerror-the-truth-value-of-an-array-with-more-than-one-element-is-ambiguous) – Daniel Azemar Sep 06 '21 at 10:45
  • Check the size of `confidence`. Use `confidence.shape` for this. – Rahul Kedia Sep 06 '21 at 12:58

0 Answers0