deedax commited on
Commit
5088bf6
·
1 Parent(s): 2bfb685

Upload 2 files

Browse files
Files changed (2) hide show
  1. README.md +77 -13
  2. training_face_facts.ipynb +0 -0
README.md CHANGED
@@ -1,13 +1,77 @@
1
- ---
2
- title: Face Facts
3
- emoji: ⚡
4
- colorFrom: red
5
- colorTo: yellow
6
- sdk: streamlit
7
- sdk_version: 1.19.0
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Face Facts
2
+ Face Facts predicts age, race, and gender of individuals from their images using advanced machine learning techniques.
3
+
4
+ # Installation
5
+ - Clone this repo ` git clone https://github.com/Daheer/face-facts.git `
6
+ - Install requirements ` pip insatll requirements.txt `
7
+ - Launch streamlit app ` streamlit run face_facts.py `
8
+
9
+ # Usage
10
+
11
+ The 'Run Face Facts' section of the app lets you upload any image. It automatically retrieves one face and uses that face as "face of interest", the image of the selected face is run through the model for prediction.
12
+
13
+ The app carries out prediction using two methods, the first employs a model that was trained to predict all three KPIs (age, gender and race) at once. The second uses three models, each trained for the individual task.
14
+
15
+ Additionally, the app lets users access more in-depth details, including visualizing the selected face-of-interest, the confidence level of the gender prediction and the probability distribution of the person's race.
16
+
17
+ The app is available and can be accessed via two platforms
18
+ - [`Hugging Face Spaces`](https://huggingface.co/spaces/deedax/face-facts)
19
+ - [`Render`](https://face-facts.onrender.com/)
20
+
21
+ # Features
22
+
23
+ - Image upload
24
+ - Face detection
25
+ - Age, Gender and Race prediction
26
+ - Multiple prediction methods
27
+ - Seamless toggle between the prediction methods
28
+ - In-depth analysis
29
+
30
+ # Built Using
31
+ - [Python](https://python.org)
32
+ - [PyTorch](https://pytorch.org)
33
+ - [PyTorch Lightning Trainer](https://www.pytorchlightning.ai/index.html)
34
+ - [Mediapipe](https://developers.google.com/mediapipe)
35
+ - [UTKFace Dataset](https://susanqq.github.io/UTKFace/)
36
+ - [Kaggle](https://www.kaggle.com/datasets/jangedoo/utkface-new)
37
+ - [Streamlit](https://streamlit.io/)
38
+
39
+ # Details
40
+
41
+ - Dataset: [UTKFace](https://susanqq.github.io/UTKFace/) was used for face facts. It consists of over 20,000 facial images with annotations of age, gender, and ethnicity. The images cover large variation in pose, facial expression, illumination, occlusion, resolution, etc. This dataset could be used on a variety of tasks, e.g., face detection, age estimation, age progression/regression, landmark localization, etc
42
+
43
+ - Data processing: The dataset exhibited a pronounced class imbalance in the age category, with a dominance of images of infants (0 - 4 years) as compared to other age ranges. This imbalance can adversely affect the performance of regression models that rely on accurate representation of all age groups. To address this issue, I employed a strategic approach that randomly discards 30% of examples containing images of individuals aged < 4.
44
+
45
+ - Model selection and training details: For the standalone models, a template convolutional neural was employed as the backbone architecture, with task-specific heads appended for each of the sub-tasks i.e. binary classification for gender prediction, regression for age prediction and multi-class classification for race prediction. The models were trained with separate pytorch lightning trainer modules for 25 epochs each. <br> As for the joint model, a single pytorch lightning trainer was used to train and optimize all three objectives.
46
+ After experimentation, I discovered the weighting scheme that performed well as follows:
47
+ * 0.001 * age loss
48
+ * gender loss
49
+ * race loss
50
+
51
+ # Performance
52
+
53
+ More details about performance can be seen here [notebook](training_face_facts.ipynb)
54
+ <br> Standalone Models
55
+
56
+ | Category | Validation Loss | Validation Accuracy |
57
+ |------------------|------------------|------------------|
58
+ | Age | 137.0 | - |
59
+ | Gender | - | 87.6% |
60
+ | Race | - | 77.5% |
61
+
62
+ Joint
63
+ | Category | Validation Loss | Validation Accuracy |
64
+ |------------------|------------------|------------------|
65
+ | Age | 174.0 | - |
66
+ | Gender | - | 88.4% |
67
+ | Race | - | 78.6% |
68
+ | Total | 0.639 | - |
69
+
70
+ # Contact
71
+
72
+ Dahir Ibrahim (Deedax Inc) <br>
73
+ Email - dahiru.ibrahim@outlook.com <br>
74
+ Twitter - https://twitter.com/DeedaxInc <br>
75
+ YouTube - https://www.youtube.com/@deedaxinc <br>
76
+ Project Link - https://github.com/Daheer/mask-check
77
+
training_face_facts.ipynb ADDED
The diff for this file is too large to render. See raw diff