# Face Keypoint Detection Method Based on Blaze_ghost Network
## 3 Proposed Method
### The Design of the Loss Function  
In this article, a new loss function called HuberWingloss is designed by linearly combining huber_loss [17] and wing_loss [18], as shown in the formula below, to supervise the training of the model. Huber_loss is typically used to handle outliers in regression problems, as it is more robust and less sensitive to outliers than L2 loss; wing_loss is a  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Layer** & **Input** & **Output** \\ \hline firstconv & (B,3,H,W) & (B,24,H/2,W/2) \\ BlazeBlock & (B,24,H/2,W/2) & (B,48,H/4,W/4) \\ Double BlazeBlock1 & (B,48,H/4,W/4) & (B,96,H/8,W/8) \\ Double BlazeBlock2 & (B,96,H/8,W/8) & (B,96,H/8,W/8) \\ ASPP & (B,96,H/8,W/8) & (B,96,H/8,W/8) \\ FC & (B,96 \(\times\) 7 \(\times\) 7) & (B,numclass) \\ \hline \hline \end{tabular}
\end{table}
Table 4: Blaze_ghost network structure.  
loss function that balances smoothness and robustness, which can effectively improve the accuracy of the model. Combining the two can further enhance the robustness of the model.  
\[abs_{error}=|y-\hat{y}| \tag{3}\]  
\[\mathit{huberloss}=\begin{cases}\frac{1}{2}(abs_{error})^{2},&\text{a}bs_{ error}\leq\delta\\ \delta\Big{(}abs_{error}-\frac{1}{2}\delta\Big{)},&\text{a}bs_{error}>\delta \end{cases} \tag{4}\]  
\[\mathit{wingloss}=\begin{cases}w*\ln\left(1+\frac{abs_{error}}{\epsilon} \right),&\text{a}bs_{error}\leq w\\ abs_{error}-c,&\text{a}bs_{error}>w\end{cases} \tag{5}\]  
\[c=w-w*\ln\left(1+\frac{w}{\epsilon}\right) \tag{6}\]  
\[L(y,\hat{y})=\mathit{huber}_{loss}+\mathit{wingloss} \tag{7}\]  
\[L_{weighted}=\mathit{euler\_angle\_weights}*L(y,\hat{y}) \tag{8}\]  
\[\mathit{HuberWingloss}=\frac{1}{N}\sum_{i=1}^{N}L_{weighted} \tag{9}\]  
In the equation, \(y\) represents the true label, \(\hat{y}\) represents the predicted value of the model, \(\mathit{abs\_error}\) represents the absolute difference between the two, \(\mathit{huberloss}\) represents the result obtained from the calculation of the huber loss function, \(\delta\) represents the critical point where the huber loss changes from square loss to linear loss, \(\mathit{wingloss}\) represents the result obtained from the calculation of the wing loss function, \(w\) and \(c\) are parameters of the wing loss function, and \(c\) is a constant. \(L(y,\hat{y})\) represents the calculation method of the total loss function, using different calculation methods in different \(\mathit{abs\_error}\) intervals. \(\mathit{euler\_angle\_weights}\) represents the weight factors of the euler angle error in each sample. When calculating the final loss value, if the \(\mathit{euler\_angle\_weights}\) parameter is not empty, then each loss function value will be further multiplied, which helps adjust the importance of different euler angle dimensions in the loss function. This can make the model pay more attention to samples with larger euler angle errors. \(L_{weighted}\) represents the weighted loss value obtained by applying the weight factor to the loss value of each sample, and, finally, \(\mathit{HuberWingloss}\) represents the sum of the weighted loss values of all samples divided by the number of samples, which is the final loss value of the model.