zye1996 / Mobilefacenet-TF2-coral_tpu

57 stars 13 forks source link

Differentiating faces after utils/generate_db.py #8

Open nathan-m-schneider-22 opened 3 years ago

nathan-m-schneider-22 commented 3 years ago

After successfully running utils/generate_db.py on several different faces (.jpg images 96x112, all different people) and using that db for inference_video, I'm still having trouble differentiating the faces. I tried to keep each face in the same format as the examples in /image, however, all the faces are assigned the same label.

After the dot product in postprocessing face_recognition, the result is typically around

[[[5.13239309]]
 [[5.13109348]]
 [[5.30474482]]
 [[5.53775566]]
 [[5.09075269]]
 [[5.30884969]]
 [[5.03641731]]]

with index 3 always chosen as the argmax, and that label is always assigned. db.npy.zip

My main question is: what format should the images be in for the model to successfully differentiate faces / is there a different way to differentiate faces outside of the db method?

nathan-m-schneider-22 commented 3 years ago

update: I tried to save feature data to a db from the camera to guarantee similarity between db data and camera input. However, the above problem persists

zye1996 commented 3 years ago

hi, I suspect that the model associated with that script is obsolete. You can try another model and I will look into it this weekend.

nathan-m-schneider-22 commented 3 years ago

Thanks for the quick reply! I've actually fixed the problem myself by creating my own db out of features from the camera. My issue was that I saved the features without normalizing them. As such, the dot product in postprocessing-face_recognition was weighted arbitrarily towards certain faces. After collecting new face data and normalizing it, the output result looked less like

[[[5.13239309]]
 [[5.13109348]]
 [[5.30474482]]
 [[5.53775566]]
 [[5.09075269]]
 [[5.30884969]]
 [[5.03641731]]]

And mapped between 0 and 1.

 [[0.94093935]]
 [[0.96431198]]
 [[0.97200852]]

I love this repo, so tomorrow I'll make a PR modifying utils/generate_db.py to make normalized data out of an image directory, along with README documentation to help new users build a db and recognize faces.

zye1996 commented 3 years ago

Thanks for the quick reply! I've actually fixed the problem myself by creating my own db out of features from the camera. My issue was that I saved the features without normalizing them. As such, the dot product in postprocessing-face_recognition was weighted arbitrarily towards certain faces. After collecting new face data and normalizing it, the output result looked less like

[[[5.13239309]]
 [[5.13109348]]
 [[5.30474482]]
 [[5.53775566]]
 [[5.09075269]]
 [[5.30884969]]
 [[5.03641731]]]

And mapped between 0 and 1.

 [[0.94093935]]
 [[0.96431198]]
 [[0.97200852]]

I love this repo, so tomorrow I'll make a PR modifying utils/generate_db.py to make normalized data out of an image directory, along with README documentation to help new users build a db and recognize faces.

That would be awesome! I will also make an interactive tool for users to record the face. Thank you so much!

nathan-m-schneider-22 commented 3 years ago

PR + docs ready, need permissions for nathan-m-schneider-22 to make a PR

zye1996 commented 3 years ago

PR + docs ready, need permissions for nathan-m-schneider-22 to make a PR

Hi I have enabled the PR can you please try one more time and let me know?

nathan-m-schneider-22 commented 3 years ago
remote: Permission to zye1996/Mobilefacenet-TF2-coral_tpu.git denied to nathan-m-schneider-22.
fatal: unable to access 'https://github.com/zye1996/Mobilefacenet-TF2-coral_tpu.git/': The requested URL returned error: 403
zye1996 commented 3 years ago

remote: Permission to zye1996/Mobilefacenet-TF2-coral_tpu.git denied to nathan-m-schneider-22. fatal: unable to access 'https://github.com/zye1996/Mobilefacenet-TF2-coral_tpu.git/': The requested URL returned error: 403

Hi did you make modification on a forked repo or you cloned the repo and modify? Probably you need take the first approach

nathan-m-schneider-22 commented 3 years ago

Cloned, branched, edited, pushed upstream branch

zye1996 commented 3 years ago

Cloned, branched, edited, pushed upstream branch

To make a pull request you have to fork the repo first and modify the forked version, otherwise, Github will reject it.