age-gender-estimation icon indicating copy to clipboard operation
age-gender-estimation copied to clipboard

Training on custom dataset

Open tanmay-bhatnagar opened this issue 5 years ago • 5 comments

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.

tanmay-bhatnagar avatar Aug 15 '19 14:08 tanmay-bhatnagar

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

yu4u avatar Aug 15 '19 16:08 yu4u

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

tanmay-bhatnagar avatar Aug 15 '19 18:08 tanmay-bhatnagar

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.

yu4u avatar Aug 17 '19 07:08 yu4u

@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?

nyck33 avatar Sep 09 '19 16:09 nyck33

Exactly.

yu4u avatar Sep 09 '19 17:09 yu4u