tdicola / pi-facerec-box

Raspberry Pi powered box which uses face recognition with OpenCV to lock and unlock itself.
Other
113 stars 49 forks source link

train.py - model.getMat #5

Open snipiba opened 8 years ago

snipiba commented 8 years ago

Hi, on opencv 3.0.0 is not recognized getMat model must by set to> model = cv2.face.createEigenFaceRecognizer()

and then getMat is not found / File "train.py", line 85, in mean = model.getMat("mean").reshape(faces[0].shape) AttributeError: 'cv2.face_BasicFaceRecognizer' object has no attribute 'getMat'

miker525 commented 8 years ago

I believe they changed quite a number of things between OpenCV 2.x.x and 3.x.x . I would suggest trying to run it with OpenCV 2.4.9 (that's the version I used and had no problems with).

snipiba commented 8 years ago

i made some changes, but still got errors on training on training model... ValueError: operands could not be broadcast together with shapes .... @ cv2.imwrite(MEAN_FILE, normalize(mean, 0, 255, dtype=np.uint8))

PaulSolheim commented 8 years ago

To get train.py to run on OpenCV 3.1:

change line 77 to: model = cv2.face.createEigenFaceRecognizer()

change line 85 to: mean = model.getMean().reshape(faces[0].shape)

and change line 87 to: eigenvectors = model.getEigenVectors()

Should also work if you are using OpenCV 3.0

vkjuju commented 6 years ago

@PaulSolheim , does the servo work on pi3 if we apply your solution ?

philanij commented 4 years ago

@PaulSolheim, Do you know what are the modifications needed on the hardware.py file when using the DC servo control other the RPIO.PWM

realprime commented 2 years ago

Hey @PaulSolheim, After using getEigenVectors() I'm getting output as [[0.][0.]......[0.][0.]] and I'm not able to generate the Positive and Negative Eigenfaces. Is there any alternative way to generate these eigenvectors for both Positive and Negative eigenfaces.