Skip to content

Age recognition using triplet and cosine embedding loss with resnet & vit backbone options

License

Notifications You must be signed in to change notification settings

ZhaoPeiduo/AgeRecognition

Repository files navigation

Age Recognition Using ResNet and Vision Transformer

Disclaimer: Here Age recognition refers to matching faces of the same person across different ages, NOT predicting a person's age given his/her face.

Dataset: Cross-Age Celebrity Dataset(CACD2000): Conatining celebrities faces across different ages.

The face crops and the identity mapping can be found in this link

Approach:

  • Apply a face detctor to the input image to capture the face and preprocess it to the standard size.
  • Initialize backbones with ImageNet pretrained weights
  • Gernate training triplets in the following manner: anchor, positive(same id, different age), negative(different id, same age)
  • Compute: a) Triplet loss and b) positive-negative cosine embedding loss
  • Loss = triplet loss + learnable regularization factor * cosine embedding loss

TODOs:

  • Dataset cleaning (face crop generation)
  • Dataset preprocessing (anchor-positive-negative sampling)
  • Model definitions
  • Loss
  • Preprocessor
  • Model Training

Age recognizers using resnet101 and vit_b_16 backbones are now avaliable here.

Evaluation Statistics

Vit_b_16: Accuracy = 0.81 at threshold of 0.65 on the test dataset (test_vit_16_b.ipynb)

Resnet101: Accuracy = 0.76 at threshold of 0.65 on the test dataset (test_resnet.ipynb)

Sample Usage(?)

Using connan anime character as illustrative examples below (where the inspiration for the project is from)

child_adult

child_diffid

sample.ipynb shows code samples to use the model for face comparison.

About

Age recognition using triplet and cosine embedding loss with resnet & vit backbone options

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published