yu4u / age-gender-estimation

Keras implementation of a CNN network for age and gender estimation
MIT License
1.47k stars 503 forks source link

Training on custom dataset #98

Open tanmay-bhatnagar opened 5 years ago

tanmay-bhatnagar commented 5 years ago

Hi, how do I train this model on a custom dataset ? I wish to fine tune the pre-trained weights. One more thing, I do not have the age of the people in the dataset, only the gender. So how do I leave out the age from training, if I can.

yu4u commented 5 years ago

In that case, it would be easy to write your code from scratch. The problem you are going to solve is a simple classification task with two classes. You can use any classification examples with custom generator like https://medium.com/@vijayabhaskar96/tutorial-image-classification-with-keras-flow-from-directory-and-generators-95f75ebe5720

tanmay-bhatnagar commented 5 years ago

What if I have the age of people ? Then how do I prepare my dataset and train the model ? I want to finetune pre-trained weights

yu4u commented 5 years ago

Please refer to https://github.com/yu4u/age-gender-estimation/blob/master/wide_resnet.py#L134-L140 for model. For dataset, you should simply prepare (image, age, gender) tuples for training.

nyck33 commented 5 years ago

@yu4u Hi Yusuke-san, so for

In that case, it would be easy to write your code from scratch. The problem you are going to solve is a simple classification task with two classes. You can use any classification examples with custom generator like https://medium.com/@vijayabhaskar96/tutorial-image-classification-with-keras-flow-from-directory-and-generators-95f75ebe5720

you mean, throw away the dense fully connected layers, use the weights for all other layers on a new network with new dense fully connected layers for two classes male or female, and train right?

yu4u commented 5 years ago

Exactly.