610265158 / Peppa_Pig_Face_Landmark

A simple face detect and alignment method, which is easy and stable.
Apache License 2.0
525 stars 116 forks source link

How to get each Facial landmarks of face? #21

Closed SaddamBInSyed closed 4 years ago

SaddamBInSyed commented 4 years ago

Thanks for great work

could you please advise how to get the left and right eye landmark?

I want to calculate the EAR of the left and right eyes.

I followed the DLIB facial points to I am getting below error

cannot reshape array of size 600 into shape (1,10,20,1)

code

`def predict_eye_state(self, image): global graph with graph.as_default(): image = cv2.resize(image, (20, 10)) image = image.astype(dtype=np.float32)

        image_batch = np.reshape(image, (1, 10, 20, 1))
        image_batch = keras.applications.mobilenet.preprocess_input(image_batch)

        return np.argmax(self.eye_model.predict(image_batch)[0])

`

Help highly appreciated.

610265158 commented 4 years ago

Hi, Because the image you resized is rgb, you should np.reshape(image, (1, 10, 20, 3)) or convert it to gray first. hope it will help.

Good luck

SaddamBInSyed commented 4 years ago

Hi @610265158

Thank you very much. all fine after convert to gray.

SaddamBInSyed commented 4 years ago

Hi @610265158

I want to run the same on the jetson nano board. I have the following understanding about this project if anything misunderstood please correct me.

  1. Performance-wise (i mean face and landmark detection accuracy) TF1 and TF2 version are same? ( so I can choose anyone)

  2. after installing the tensorfow gpu version, I can directly use this code on jetson nano and the pepa-face engine app will consume GPU automatically for all face detection and landmark detection.

please clarify. please