# Hybrid-Margin Softmax for the Detection of Trademark Image Similarity
## 3 Results
### Loss-Driven Method Experiments  
To prove that HMS enables the SNN to learn separable enough features of a TM image, we compared the detection models based on different transformations of softmax under the same experimental conditions. The accuracy and F1 score of detecting similar and dissimilar TM image pairs are shown in Tables 1 and 2. We also tested the detection model on the LFW dataset while the SNN was still trained with TM image data. The results are shown in Tables 3 and 4.  
For the TMISD task, SphereFace achieves up to 96.39% accuracy, which outperforms CosFace and ArcFace greatly. However, when the depth of SNN increases, the model is overfitted severely. The accuracy of HMS regarding normalization of feature and weight vectors is slightly better than that of CosFace and ArcFace. HMS achieves the best performance, with up to 98.97% accuracy, which is a 2.58% improvement over SphereFace. Another notable thing is that a simple six-layer SNN trained on HMS works well on the TMISD task, with 97.45% accuracy and an F1 score of 0.9516.  
Figure 5: The structure of the 6-layer CNN.  
For the FR task, the detection model trained on SphereFace with TM data is overfitted. The performance of HMS (normalized) is also better than that of CosFace and ArcFace. The model trained on HMS generalizes well on the LFW dataset with up to 90.57% accuracy and an F1 score of 0.9002. A simple six-layer SNN trained on HMS can reach 80.45% accuracy and an F1 score of 0.8173.  
The performances of HMS with different depths of SNN were tested, as shown in Tables 1-4. ResNet18 was adequate for meeting the demand of the TMISD task and generalizing on the FR task. This also indicates that the SNN penalized by HMS is adequate to learn sufficient and critical information with fewer network layers. The training expenses are reduced as a result.  
The detection accuracy of the model (resnet18) trained on HMS with different hyperparameters is shown in Figure 6. The accuracy fluctuation caused by scale factor \(s\) is higher than the margin \(d_{1}\) and \(d_{2}\).  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{**Transformations of**} & \multicolumn{6}{c}{**Accuracy (\%)**} \\ \cline{2-7}  & **6-Layer** & **ResNet18** & **ResNet34** & **ResNet50** & **ResNet101** & **ResNet152** \\ \hline SphereFace [16] & 96.25 & 95.36 & 96.39 & — * & — & — \\ CosFace [17, 18] & 43.81 & 51.55 & 52.06 & 52.58 & 55.15 & 58.76 \\ ArcFace [19] & 46.39 & 47.94 & 53.09 & 52.06 & 56.70 & 52.58 \\ HMS (normalized) & 54.12 & 53.61 & 54.12 & 57.73 & 52.06 & 53.09 \\ HMS & 97.45 & 97.42 & 97.94 & **98.39** & 98.97 & 98.52 \\ \hline \hline \end{tabular} Note: *—indicates that SNN is overfitted, same below.  
\end{table}
Table 1: The accuracy of the TMISD task.  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{**Transformations of**} & \multicolumn{6}{c}{**F1 Score**} \\ \cline{2-7}  & **6-Layers** & **ResNet18** & **ResNet34** & **ResNet50** & **ResNet101** & **ResNet152** \\ \hline SphereFace [16] & — & — & — & — & — & — \\ CosFace [17, 18] & 45.63 & 47.25 & 46.97 & 47.38 & 47.82 & 46.38 \\ ArcFace [19] & 46.05 & 48.23 & 49.07 & 48.63 & 46.87 & 46.90 \\ HMS (normalized) & 50.13 & 50.50 & 49.06 & 50.55 & 48.30 & 51.18 \\ HMS & 80.45 & **90.57** & 82.45 & 82.30 & 84.17 & 82.90 \\ \hline \hline \end{tabular}
\end{table}
Table 3: The accuracy of the FR task.  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{**Transformations of**} & \multicolumn{6}{c}{**F1 Score**} \\ \cline{2-7}  & **6-Layers** & **ResNet18** & **ResNet34** & **ResNet50** & **ResNet101** & **ResNet152** \\ \hline SphereFace [16] & — & — & — & — & — & — \\ CosFace [17, 18] & 45.63 & 47.25 & 46.97 & 47.38 & 47.82 & 46.38 \\ ArcFace [19] & 46.05 & 48.23 & 49.07 & 48.63 & 46.87 & 46.90 \\ HMS (normalized) & 50.13 & 50.50 & 49.06 & 50.55 & 48.30 & 51.18 \\ HMS & 80.45 & **90.57** & 82.45 & 82.30 & 84.17 & 82.90 \\ \hline \hline \end{tabular}
\end{table}
Table 4: The F1 score of the FR task.