Pour exécuter le script python prediction_age_gender.py
en modifiant le lien de la photo dans image_path
- ageWeights: weight for the age model
- build_predicator.py: script to build the age/gender graph (it also call "modelGender.py")
- detected_faces: example of extracted faces (it was mostly done for debugging purpose)
- freeze_graph: the yolo model + the weight (i froze the network)
- genderWeights: gender for the age model (the branch for the gender)
- image: examples of image and their respective output
- log: it 's where I put the tensorboard log
- modelGender.py: script to build the gender graph
- model.py: helper for building the inception model
- prediction_age_gender.py: the main python script
- utils.py: useful functions
- video: examples of video and its output
Set conda environmet
conda env create -f gender_age.yml
source activate gender_age
python prediction_age_gender.py
-
You can modify the value of
image_path
inprediction_age_gender.py
to run our model on your own picture/video. -
Note: For the sake of simplicity, I use Keras for the YOLO implementation, but I use tensorflow for the other graphs.
-
Note2: Don't forget to download the weight and to put them in th corresponding folder (ageWeights/freeze_graph/genderWeights)
- This link to each of them is available in the folder
Several prediction errors could happen in the following case:
- The face is too far from the camera
- The picture used in the training mostly includes people that are relatively closed to the camera
- The picture includes many character that are very closed to each other
- The picture used in the training mostly includes people are not too closed for each other
- The face is very closed to the border
- Our system consists in the combination of 2 neural networks. The first one extract the faces as a square image, the second one resize them to the correct input size and predicts the corresponding label of each of them. However if the face is closed to the picture's border, the extracted face may not be a square size image, which force our system to distord the image in order to make it fit in our model. It can lead to potential errors.
- The lighting condition are very different from our training set
- The picture used in the test set should have similar distribution as the validation set.
In deep learning, it important to know that the training set should cover sufficiently the scenarios that you want to score later on. If the classifier sees fully new concepts or contexts it is likely to perform badly. Just a few examples:
- You train only on images from a constraint environment (say, indoor) and try to score images from a different environment (outdoor).
- You train only on images of a certain make and try to score others.
- Your test images have largely different characteristics, e.g. with respect to illumination, background, color, size, position, etc.
- Your test images contain entirely new concepts.
As a result, we invite the reader to fine tune our model in case it makes some prediction errors with their test set (see previous section). Another parameter that ca be adjusted is size of the face that is extracted (go to "utils.py" and search for 'getFacesList' and adjust the size of maxDist)
- Each label is written like gender, (age_interval)
- The exact age cannot be guessed without large training dataset (which we don't have)
- Instead we guess the age intervale
Input | Output |
---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |