experiencor / keras-yolo3

Training and Detecting Objects with YOLO3
MIT License
1.6k stars 861 forks source link

ValueError: not enough values to unpack (expected 4, got 1) #314

Open ishitasinghal opened 3 years ago

ishitasinghal commented 3 years ago

`import cv2 trained_face_data = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

img = cv2.imread('am.jpg')

bwimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

face_crdnts = trained_face_data.detectMultiScale(bwimg) (x, y, w, b) = face_crdnts #problem in this line

cv2.rectangle(img, (x,y), (x+w, y+b), (0, 300, 0), 1) cv2.imshow("That's u!!",img) cv2.waitKey() print("I am done!")`

Capture

This is a face detection code snippet I am trying to run, but it is giving the "ValueError". I tried to use the for loop to get the variables from the list being created in the coordinate detect function, but it still doesn't work.

Can anyone help me with this code.

lexuansanh commented 3 years ago

face_crdnts only have 1 value. you should check type and shape of face_crdnts...