justadudewhohacks / face-api.js

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js
MIT License
16.53k stars 3.68k forks source link

Missing Age and Gender detection #106

Closed MakarandKate closed 5 years ago

MakarandKate commented 5 years ago

Please add age and gender detection in lib

justadudewhohacks commented 5 years ago

Sounds like a reasonable extension. Any links to repos with pretrained models would be helpful.

Bajajar commented 5 years ago

Sounds like a reasonable extension. Any links to repos with pretrained models would be helpful.

You can take a look at this https://github.com/bharathvaj1995/gender-detection-tensorflowjs and the pretrained here https://s3.ap-south-1.amazonaws.com/arunponnusamy/pre-trained-weights/gender_detection.model However, I'm using this works https://github.com/oarriaga/face_classification and the results so far is pretty good. I would have provided the codes for that.

ghost commented 5 years ago

How could I perform transfer learning and train, over which models files, to add gender / age recognition. If I had an already trained model, how could I "plug" it into the API?

justadudewhohacks commented 5 years ago

Not sure if I understood correctly.

If you want to train your own model with transfer learning, I would actually try to use the face landmark model and replace the fully connected layer with an own one that outputs male / female.

Regarding the second question: What kind of model do you have? A tensorflow.js web model? If it is a plain tensorflow model you can probably convert it to a web model using the tfjs-converter tool.

ghost commented 5 years ago

Sorry, I'm new to TensorFlow. I'd need the outputs of face classification to include gender and approximate age. I currently don't know how to do it, not even in a way that would result in a model compatible with this API.

On Thu, Nov 29, 2018, 6:00 PM justadudewhohacks <notifications@github.com wrote:

Not sure if I understood correctly.

If you want to train your own model with transfer learning, I would actually try to use the face landmark model and replace the fully connected layer with an own one that outputs male / female.

Regarding the second question: What kind of model do you have? A tensorflow.js web model? If it is a plain tensorflow model you can probably convert it to a web model using the tfjs-converter tool.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/justadudewhohacks/face-api.js/issues/106#issuecomment-442991296, or mute the thread https://github.com/notifications/unsubscribe-auth/AmUwmR5cAzKmjR2T48aQ2qAnYBzMkKxdks5u0ErngaJpZM4XxM-b .

ghost commented 5 years ago

Sorry again. If I had a couple of TensoFlow.js Web models for gender / age classification of faces, could I "pipeline" them with each detected face from this API, maybe using single image recognition (not object detection), augmenting the face output predictions with these attributes?

justadudewhohacks commented 5 years ago

Yes, I mean the input of such a model would probably be the image of a face right? So you basically use face-api.js to detect and extract faces from an image and pass these into your network. Does that answer your question?

ghost commented 5 years ago

Yes, and thanks! I've just saw it was an enhancement request and tought it could be part of the API itself. Again, sorry for my lack of knowledge.

On Thu, Nov 29, 2018, 6:39 PM justadudewhohacks <notifications@github.com wrote:

Yes, I mean the input of such a model would probably be the image of a face right? So you basically use face-api.js to detect and extract faces from an image and pass these into your network. Does that answer your question?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/justadudewhohacks/face-api.js/issues/106#issuecomment-443002806, or mute the thread https://github.com/notifications/unsubscribe-auth/AmUwmYEz6894ojLr39cYViA3zpLN7D3Mks5u0FP1gaJpZM4XxM-b .

justadudewhohacks commented 5 years ago

Some datasets: https://susanqq.github.io/UTKFace/ https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/

ghost commented 5 years ago

Thanks! It will be of great help.

On Sat, Dec 1, 2018, 1:45 PM justadudewhohacks <notifications@github.com wrote:

Some datasets: https://susanqq.github.io/UTKFace/ https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/justadudewhohacks/face-api.js/issues/106#issuecomment-443439468, or mute the thread https://github.com/notifications/unsubscribe-auth/AmUwmfuTQHfq6zVPIyp-RBAwBuEb5NpYks5u0rIpgaJpZM4XxM-b .

justadudewhohacks commented 5 years ago

Yeah, age and gender recognition is not implemented yet, I am collecting some resources at the moment.

buggles333 commented 5 years ago

+1 from me, gender detection would be a great addition

justadudewhohacks commented 5 years ago

Age, gender, ethnicity recognition is next on my list. Fortunately there is lot's of data available. Can't promise any ETA yet.

examityharikrishna commented 5 years ago

That's great!

Bajajar commented 5 years ago

A dataset from IBM https://www.research.ibm.com/artificial-intelligence/trusted-ai/diversity-in-faces/#access

PutziSan commented 5 years ago

Hi, Thank you so much for the library, great work! I also find the age and gender recognition quite interesting and had seen that you had already started the implementation in a branch. Can you already give an estimate when you will release it?

justadudewhohacks commented 5 years ago

I am working on it a little bit more actively currently. Can't give any estimations yet when to I will release it, sorry. I have some first working versions, but I am constantly improving the model accuracy, trying to get close to state of the art.

dkzeb commented 5 years ago

I am working on it a little bit more actively currently. Can't give any estimations yet when to I will release it, sorry. I have some first working versions, but I am constantly improving the model accuracy, trying to get close to state of the art.

First off - amazing work on this ;) is it possible to play around with your current implementation? do you have it in a branch that we can access?

justadudewhohacks commented 5 years ago

Age estimation and gender prediction is now implemented.

examityharikrishna commented 5 years ago

That's great news!

thirukumars commented 5 years ago

script.js:26 Uncaught (in promise) TypeError: faceapi.detectAllFaces(...).withFaceLandmarks(...).withFaceExpressions(...).withAgeGender is not a function

I got this error message while running,please help me out

justadudewhohacks commented 5 years ago

it should be withAgeAndGender and not withAgeGender

thirukumars commented 5 years ago

thank you and for draw

faceapi.draw.drawAgeAndGender is not a function

thirukumars commented 5 years ago

hello where do i found the code for recognizing two image without node and using javascript

ismaildkc commented 4 years ago

@thirukumars hello, i'm getting same error, "faceapi.draw.drawAgeAndGender is not a function" did you solve that?