-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
289 lines (208 loc) · 9.34 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Facial Landmark Points Detection</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #FEFCF3;
color: #0D9276;
margin: 20px;
}
header {
text-align: center;
margin-bottom: 25px;
color: #6D2932;
}
#main-content {
max-width: 1200px;
margin: auto;
margin-top:20px;
background-color: #fff;
padding: 20px;
border-radius: 12px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}
code {
background-color: #BAD1C2; /* Dark Gray Code Background */
border: 1px solid #F0F0F0; /* Border Color */
border-left: 3px solid #860A35; /* Accent Color */
color: #0C2D57; /* Light Code Text Color */
display: block;
margin: 10px 0;
padding: 10px;
overflow-x: auto;
}
pre {
overflow: auto;
}
img {
display: block;
margin: 0 auto;
max-width: 50%;
height: auto;
}
blockquote {
background: #2d2d2d; /* Darker Gray for Blockquote */
border-left: 10px solid #FC6736;
margin: 1.5em 10px;
padding: 0.5em 10px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #860A35;
text-align: center;
}
h1 {
font-size: 3em;
color: #224B0C; /* Light Text Color for Heading */
}
h2 {
font-size: 2.5em;
color: #42855B; /* Light Text Color for Heading */
}
h3 {
font-size: 2em;
color: #90B77D; /* Light Text Color for Heading */
}
h4 {
font-size: 1.8em;
color: #436850; /* Light Text Color for Heading */
}
h5 {
font-size: 1.5em;
color: #436850; /* Light Text Color for Heading */
}
h6 {
font-size: 1.2em;
color: #436850; /* Light Text Color for Heading */
}
strong {
color: #436850;
}
a {
color: #40A2E3;
transition: color 0.5s;
}
a:hover {
color: #f45026;
}
p {
color: #555;
}
</style>
</head>
<body>
<h1>Facial Landmark Points Detection Using Knowledge Distillation-Based Neural Networks</h1>
<div id="main-content">
<h2>Introduction</h2>
<p>Facial landmark detection is a vital step for numerous facial image analysis applications. Although some deep learning-based methods have achieved good performances in this task, they are often not suitable for running on mobile devices. Such methods rely on networks with many parameters, which makes the training and inference time-consuming. Training lightweight neural networks such as MobileNets are often challenging, and the models might have low accuracy. Inspired by knowledge distillation (KD), this paper presents a novel loss function to train a lightweight Student network (e.g., MobileNetV2) for facial landmark detection. We use two Teacher networks, a Tolerant-Teacher and a Tough-Teacher in conjunction with the Student network. The Tolerant-Teacher is trained using Soft-landmarks created by active shape models, while the Tough-Teacher is trained using the ground truth (aka Hard-landmarks) landmark points. To utilize the facial landmark points predicted by the Teacher networks, we define an Assistive Loss (ALoss) for each Teacher network. Moreover, we define a loss function called KD-Loss that utilizes the facial landmark points predicted by the two pre-trained Teacher networks (EfficientNet-b3) to guide the lightweight Student network towards predicting the Hard-landmarks. Our experimental results on three challenging facial datasets show that the proposed architecture will result in a better-trained Student network that can extract facial landmark points with high accuracy.</p>
</div>
<div id="main-content">
<h2>Architecture</h2>
<p>We train the Tough-Teacher, and the Tolerant-Teacher networks independently using the Hard-landmarks and the Soft-landmarks respectively utilizing the L2 loss:</p>
<img src="https://github.com/aliprf/KD-Loss/blob/master/samples/teacher_arch-1.jpg?raw=true" alt="teacher_arch">
<p>Proposed KD-based architecture for training the Student network. KDLoss uses the knowledge of the previously trained Teacher networks by utilizing the assistive loss functions ALossT ou and ALossT ol, to improve the performance the face alignment task:</p>
<img src="https://github.com/aliprf/KD-Loss/blob/master/samples/general_framework-1.jpg?raw=true" alt="general_framework">
</div>
<div id="main-content">
<h2>Evaluation</h2>
<p>Following are some samples to show the visual performance of KD-Loss on 300W, COFW, and WFLW datasets:</p>
<h3>300W:</h3>
<img src="https://github.com/aliprf/KD-Loss/blob/master/samples/KD_300W_samples-1.jpg?raw=true" alt="KD_300W_samples">
<h3>COFW:</h3>
<img src="https://github.com/aliprf/KD-Loss/blob/master/samples/KD_cofw_samples-1.jpg?raw=true" alt="KD_cofw_samples">
<h3>WFLW:</h3>
<img src="https://github.com/aliprf/KD-Loss/blob/master/samples/KD_WFLW_samples-1.jpg?raw=true" alt="KD_WFLW_samples">
</div>
<div id="main-content">
<h2>Installing the requirements</h2>
<p>In order to run the code, you need to install python >= 3.5. The requirements and the libraries needed to run the code can be installed using the following command:</p>
<pre>
<code>
pip install -r requirements.txt
</code>
</pre>
</div>
<div id="main-content">
<h2>Using the pre-trained models</h2>
<p>You can test and use the pre-trained models using the following codes, which are available in the test.py. The pretrained student model is also located in "models/students".</p>
<pre>
<code>
cnn = CNNModel()
model = cnn.get_model(arch=arch, input_tensor=None, output_len=self.output_len)
model.load_weights(weight_fname)
img = None # load a cropped image
image_utility = ImageUtility()
pose_predicted = []
image = np.expand_dims(img, axis=0)
pose_predicted = model.predict(image)[1][0]
</code>
</pre>
</div>
<div id="main-content">
<h2>Training Network from scratch</h2>
<h3>Preparing Data</h3>
<p>Data needs to be normalized and saved in npy format.</p>
<h3>Training Teacher Networks:</h3>
<p>The training implementation is located in teacher_trainer.py class. You can use the following code to start the training for the teacher networks:</p>
<pre>
<code>
'''train Teacher Networks'''
trainer = TeacherTrainer(dataset_name=DatasetName.w300)
trainer.train(arch='efficientNet', weight_path=None)
</code>
</pre>
<h3>Training Student Networks:</h3>
<p>After Training the teacher networks, you can use the trained teachers to train the student network. The implementation of training the student network is provided in teacher_trainer.py. You can use the following code to start the training for the student networks:</p>
<pre>
<code>
st_trainer = StudentTrainer(dataset_name=DatasetName.w300, use_augmneted=True)
st_trainer.train(arch_student='mobileNetV2', weight_path_student=None,
loss_weight_student=2.0,
arch_tough_teacher='efficientNet', weight_path_tough_teacher='./models/teachers/ds_300w_ef_tou.h5',
loss_weight_tough_teacher=1,
arch_tol_teacher='efficientNet', weight_path_tol_teacher='./models/teachers/ds_300w_ef_tol.h5',
loss_weight_tol_teacher=1)
</code>
</pre>
</div>
<div id="main-content">
<p><a href="https://github.com/aliprf/KD-Loss"><img src="https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/facial-landmark-points-detection-using/face-alignment-on-cofw" alt="GitHub"></a></p>
<ul>
<li><strong>Link to the paper:</strong></li>
<ul>
<li><a href="https://scholar.google.com/citations?view_op=view_citation&hl=en&user=96lS6HIAAAAJ&citation_for_view=96lS6HIAAAAJ:zYLM7Y9cAGgC">Google Scholar</a></li>
<li><a href="https://www.sciencedirect.com/science/article/pii/S1077314221001582">Elsevier</a></li>
<li><a href="https://arxiv.org/abs/2111.07047">Arxiv</a></li>
</ul>
<li><strong>Link to the paperswithcode.com:</strong> <a href="https://paperswithcode.com/paper/facial-landmark-points-detection-using">https://paperswithcode.com/paper/facial-landmark-points-detection-using</a></li>
</ul>
</div>
<div id="main-content">
<h2>Referencee</h2>
<pre>
<code>
Please cite this work as:
@article{fard2022facial,
title={Facial landmark points detection using knowledge distillation-based neural networks},
author={Fard, Ali Pourramezan and Mahoor, Mohammad H},
journal={Computer Vision and Image Understanding},
volume={215},
pages={103316},
year={2022},
publisher={Elsevier}
}
</code>
</pre>
</div>
</div>
</body>
</html>